15

@interface ViewController ()

@property (nonatomic, retain) NSMutableArray *dataArrary;

@property (nonatomic, retain) NSMutableArray *dogArray;

@property (nonatomic, retain) NSMutableArray *huluArray;

@property (nonatomic, retain) NSMutableArray *beautyArray;

@property(nonatomic, retain) NSMutableArray *modelArray;

- (void)handleData;

@end

 

@implementation ViewController

 

- (void)handleData {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Student" ofType:@"plist"];

    NSArray *array = [NSArray arrayWithContentsOfFile:path];

//    NSLog(@"%@",array);

    _modelArray = [[NSMutableArray alloc]initWithCapacity:0];

    for (NSDictionary *dic in array) {

        //将每一个字典转化为模型,将模型加到数组中去

        Student *student = [[Student alloc] init];

        [student setValuesForKeysWithDictionary:dic];

        [_modelArray addObject:student];

                                }

    NSLog(@"%@",_modelArray);

    

}

- (void)viewDidLoad {

    [super viewDidLoad];

    [self handleData];

    _dogArray = [[NSMutableArray alloc]initWithObjects:@"金毛",@"拉布拉多",@"斗牛犬",@"哈士奇",@"藏獒", nil];

    

    _huluArray = [[NSMutableArray alloc]initWithObjects:@"醉醉",@"洪荒",@"琳琳",@"福福",@"中二",@"倩倩",@"我擦", nil];

    

    _beautyArray = [[NSMutableArray alloc] initWithObjects:@"木乃伊",@"掘墓",@"战争之影",@"剑姬",@"轻女",@"奶妈",@"凤女", nil];

    

    _dataArrary = [[NSMutableArray alloc]initWithObjects:_dogArray,_beautyArray,_huluArray, nil];

    

//    _dataArrary = [[NSMutableArray alloc]initWithObjects:@"薇恩",@"雷熊",@"女巫",@"疯狗",@"德玛",@"复仇之矛",@"女枪",nil];

    

    UITableView *tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] bounds] style:UITableViewStyleGrouped];

    

//    [tableView reloadData];

    

    tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;

    tableView.separatorColor = [UIColor redColor];

    

//    tableView.rowHeight = 150;

//    NSLog(@"%f",tableView.rowHeight);  //如果没设置,则不能打印出默认行高

    

//    UITableViewdatasource协议

    tableView.dataSource = self;

    tableView.delegate = self;

    

 

 

 

    

    

    

    [self.view addSubview:tableView];

    // Do any additional setup after loading the view, typically from a nib.

}

 

-(BOOL)prefersStatusBarHidden {

    return  YES;

}

 

@interface ViewController ()

@property (nonatomic, retain) NSMutableArray *dataArrary;

@property (nonatomic, retain) NSMutableArray *dogArray;

@property (nonatomic, retain) NSMutableArray *huluArray;

@property (nonatomic, retain) NSMutableArray *beautyArray;

@property(nonatomic, retain) NSMutableArray *modelArray;

- (void)handleData;

@end

 

@implementation ViewController

 

- (void)handleData {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Student" ofType:@"plist"];

    NSArray *array = [NSArray arrayWithContentsOfFile:path];

//    NSLog(@"%@",array);

    _modelArray = [[NSMutableArray alloc]initWithCapacity:0];

    for (NSDictionary *dic in array) {

        //将每一个字典转化为模型,将模型加到数组中去

        Student *student = [[Student alloc] init];

        [student setValuesForKeysWithDictionary:dic];

        [_modelArray addObject:student];

                                }

    NSLog(@"%@",_modelArray);

    

}

- (void)viewDidLoad {

    [super viewDidLoad];

    [self handleData];

    _dogArray = [[NSMutableArray alloc]initWithObjects:@"金毛",@"拉布拉多",@"斗牛犬",@"哈士奇",@"藏獒", nil];

    

    _huluArray = [[NSMutableArray alloc]initWithObjects:@"醉醉",@"洪荒",@"琳琳",@"福福",@"中二",@"倩倩",@"我擦", nil];

    

    _beautyArray = [[NSMutableArray alloc] initWithObjects:@"木乃伊",@"掘墓",@"战争之影",@"剑姬",@"轻女",@"奶妈",@"凤女", nil];

    

    _dataArrary = [[NSMutableArray alloc]initWithObjects:_dogArray,_beautyArray,_huluArray, nil];

    

//    _dataArrary = [[NSMutableArray alloc]initWithObjects:@"薇恩",@"雷熊",@"女巫",@"疯狗",@"德玛",@"复仇之矛",@"女枪",nil];

    

    UITableView *tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] bounds] style:UITableViewStyleGrouped];

    

//    [tableView reloadData];

    

    tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;

    tableView.separatorColor = [UIColor redColor];

    

//    tableView.rowHeight = 150;

//    NSLog(@"%f",tableView.rowHeight);  //如果没设置,则不能打印出默认行高

    

//    UITableViewdatasource协议

    tableView.dataSource = self;

    tableView.delegate = self;

    

 

 

 

    

    

    

    [self.view addSubview:tableView];

    // Do any additional setup after loading the view, typically from a nib.

}

 

-(BOOL)prefersStatusBarHidden {

    return  YES;

}

 

转载于:https://www.cnblogs.com/whwhll/p/5208825.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值