设为首页 加入收藏

TOP

【代码笔记】iOS-iCarouselDemo(一)
2017-10-13 10:24:16 】 浏览:3903
Tags:代码 笔记 iOS-iCarouselDemo

一,效果图。

二,工程图。

三,代码。

RootViewController.h

RootViewController.m

myCell.h

复制代码
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@interface myCell : UITableViewCell
{
    UILabel * myLable;
    UIImageView * myImageView;
    UILabel * title;
}
@property (strong,nonatomic) UILabel * myLabel;
@property (strong,nonatomic) UIImageView * myImageView;
@property (strong,nonatomic) UILabel * title;
@end
复制代码

 

myCell.m

复制代码
#import "myCell.h"

@implementation myCell

@synthesize myLabel;
@synthesize myImageView;
@synthesize title;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        myLabel = [[UILabel alloc] init];
        myLabel.lineBreakMode=NSLineBreakByCharWrapping;
        myLabel.numberOfLines = 0;
        myLabel.font = [UIFont fontWithName:@"MicrosoftYaHei" size:20.0];
        [self addSubview:myLabel];
        
        myImageView = [[UIImageView alloc] init];
        [self addSubview:myImageView];
        
        title = [[UILabel alloc] init];
        title.frame = CGRectMake(10, 10, 50, 30);
        title.backgroundColor = [UIColor colorWithRed:230/255.0 green:192/255.0 blue:203/255.0 alpha:1.0];
        title.layer.cornerRadius = 10.0;
        [self addSubview:title];
       ;
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
}
@end
复制代码

 

CardViewController.h

复制代码
#import <UIKit/UIKit.h>

@interface CardViewController : UIViewController
<UITableViewDataSource,UITableViewDelegate>
{
    NSMutableArray *array ;
    NSMutableArray * titleArray;
}
@property (strong ,nonatomic) NSMutableArray *array;
@property (strong,nonatomic) NSString * month;
@property (strong,nonatomic) NSString * imageName;
@property (strong,nonatomic) NSString * title;

@end
复制代码

 

CardViewController.m

复制代码
#import "CardViewController.h"
#import "myCell.h"

@interface CardViewController ()

@end

@implementation CardViewController
@synthesize array;
@synthesize month;
@synthesize imageName;
@synthesize title;


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

-(void)viewDidLoad
{
    [super viewDidLoad];
    
    
    NSDictionary * dic1 = [[NSDictionary alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"BabyCard" ofType:@"plist"]];
    self.array = [dic1 objectForKey:month];
    
    NSDictionary * dic2 = [[NSDictionary alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Title" ofType:@"plist"]];
    titleArray = [[NSMutableArray alloc] init];
    titleArray = [dic2 objectForKey:title];
    
    UITableView * tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 460) style:UITableViewStylePlain];
    tableView.delegate = self;
    tableView.dataSource = self;
    tableView.showsVerticalScrollIndicator = NO;
    [self.view addSubview:tableView];
    
    
    UIButton * back = [
首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇iOS9弹框的最新两种方式(解决控.. 下一篇【Swift学习】Swift编程之旅---闭..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目