@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;
}