1.創(chuàng)建控制器募寨,繼承與UIViewController赡茸,并且創(chuàng)建一個(gè)繼承與UITabBarController,添加控制器的圖片和文字
2.創(chuàng)建控制器悬垃,設(shè)置幾個(gè)滑動(dòng)頁(yè)面游昼,創(chuàng)建幾個(gè)控制器
導(dǎo)入第三方FSScrollContentView
3.初始化滑動(dòng)界面控制器和導(dǎo)入的第三方控制器,遵守協(xié)議SliderLineViewDelegate
4.創(chuàng)建顏色尝蠕,自動(dòng)滑到第二頁(yè)
滑動(dòng)頁(yè)面添加數(shù)據(jù)
- (void)viewDidLoad {
? ? [super viewDidLoad];
_dataArray = [NSMutableArray array];
? ? _tableview = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
? ? _tableview.dataSource = self;
? ? _tableview.delegate = self;
? ? _tableview.rowHeight =80;
? ? [_tableview registerClass:[FirstTableViewCell class] forCellReuseIdentifier:@"FirstTableViewCell"];
? ? [self.view addSubview:_tableview];
? ? [selfgetData];
}
-(void)getData{
? ? AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
? ? [managerGET:URLparameters:nilsuccess:^(NSURLSessionDataTask*task,idresponseObject) {
? ? ? ? NSLog(@"==========success:%@",responseObject);
? ? ? ? NSDictionary*response = (NSDictionary*)responseObject;
? ? ? ? NSArray*array = (NSArray*)response[@"data"];
? ? ? ? NSMutableArray *temparray = [NSMutableArray array];
? ? ? ? for(iditeminarray) {
? ? ? ? ? ? Model*m = [Modelyy_modelWithJSON:item];
? ? ? ? ? ? [temparrayaddObject:m];
? ? ? ? }
? ? ? ? [self->_dataArrayaddObjectsFromArray:temparray];
? ? ? ? [NSOperationQueue.mainQueue addOperationWithBlock:^{
? ? ? ? ? ? [self->_tableviewreloadData];
? ? ? ? }];
? ? }failure:^(NSURLSessionDataTask *task, NSError *error) {
? ? ? ? NSLog(@"error:%@",error);
? ? ? ? [self->_dataArray removeAllObjects];
? ? ? ? [NSOperationQueue.mainQueue addOperationWithBlock:^{
? ? ? ? ? ? [self->_tableviewreloadData];
? ? ? ? }];
? ? }];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView*)tableView{
? ? return 1;
}
-(NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section{
? ? return _dataArray.count;
}
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{
? ? FirstTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"FirstTableViewCell"];
? ? if(!cell) {
? ? ? ? cell = [[FirstTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"FirstTableViewCell"];
? ? }
? ? Model*model =_dataArray[indexPath.row];
? ? cell.title.text= model.author;
? ? cell.deTitle.text= model.title;
? ? [cell.picsd_setImageWithURL:[NSURLURLWithString:model.imageUrl]];
? ? cell.textLabel.backgroundColor = [UIColor redColor];
? ? returncell;
}