#import "SchoolViewController.h"
#import "SchoolTableViewCell.h"
#import "SchoolModel.h"
#import "CollocationDetailController.h"
@interface ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong)UITableView *tableview;
@property (nonatomic,strong)NSMutableArray *dataArry;
@end
@implementation
-(NSMutableArray *)dataArry{
if (!_dataArry) {
_dataArry = [NSMutableArray array];
}
return _dataArry;
}
- (void)viewDidLoad {
[super viewDidLoad];
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
self.navigationItem.title = @"专题列表";
self.view.backgroundColor = [UIColor whiteColor];
[self network];
[self setupTableview];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)setupTableview{
self.tableview = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, ScreenW, ScreenH -64) style:UITableViewStyleGrouped];
self.tableview.delegate = self;
self.tableview.dataSource = self;
self.tableview.showsVerticalScrollIndicator = NO;
self.tableview.scrollEnabled = YES;
self.tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableview.backgroundColor = [UIColor whiteColor];
[self.view addSubview:self.tableview];
}
#pragma mark -- tableviewDelegate
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return self.dataArry.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return 120;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
SchoolTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
if (!cell){
cell = [[SchoolTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
SchoolModel *model = self.dataArry[indexPath.row];
cell.model = model;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
SchoolModel *model = self.dataArry[indexPath.row];
CollocationDetailController *detail = [[CollocationDetailController alloc]init];
detail.guid = model.special_guid;
detail.thum = model.special_thumb;
detail.indexpath = indexPath.row;
detail.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:detail animated:YES];
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
return nil;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
return nil;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 0.001;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 0.001;
}
-(void)network{
}
@end
近期评论