#pragma mark - 創(chuàng)建UITableView
- (UITableView*)tableView
{
? ? if(_tableView==nil) {
? ? ? ? CGFloatheight =HEIGHT-naviHeight-34;
? ? ? ? _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, height) style:(UITableViewStylePlain)];
? ? ? ? _tableView.backgroundColor = tableSectionColor;
? ? ? ? _tableView.tableFooterView = [[UIView alloc] init];
? ? ? ? _tableView.separatorInset = UIEdgeInsetsZero;
? ? ? ? _tableView.dataSource=self;
? ? ? ? _tableView.delegate=self;
? ? ? ? [_tableView registerNib:[UINib nibWithNibName:@"sellShowTableViewCell" bundle:nil] forCellReuseIdentifier:@"sellShowTableViewCell"];
? ? }return _tableView;
}
#pragma mark -UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView
{
?? ? return1;
}
- (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section
{
? ? return [_listArray count];
}
- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
? ? _model = [[SaleListModel alloc]init];
? ? staticNSString*cellIndentifier =@"sellShowTableViewCell";//這里的cellID就是cell的xib對(duì)應(yīng)的名稱
? ? sellShowTableViewCell*cell = (sellShowTableViewCell*)[tableViewdequeueReusableCellWithIdentifier:cellIndentifier];
? ? if(nil== cell) {
? ? ? ? NSArray*nib = [[NSBundlemainBundle]loadNibNamed:cellIndentifierowner:selfoptions:nil];
? ? ? ? cell = [nibobjectAtIndex:0];
? ? }
? ? _model= [_listArrayobjectAtIndex:indexPath.row];
? ? _tableView.rowHeight = cell.frame.size.height;
? ? cell.selectionStyle = UITableViewCellSelectionStyleNone;
? ? returncell;
}
#pragma mark -UITableViewDelegate
- (CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath*)indexPath
{
? ? return 108;
}
#pragma mark -進(jìn)入出售詳情頁面
- (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(NSIndexPath*)indexPath
{
? ? _model= [_listArrayobjectAtIndex:indexPath.row];
? ? [self.delegate goToSellDetils:_model.DetailUrl];
}
//- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
//? ? if (section ==0) {
//
//? ? ? ? NSArray *arr = [NSArray arrayWithObjects:_cityNameStr,@"交易類型 ",@"篩選 ", nil];
//? ? ? ? _headerView = [[UIView alloc] initWithFrame:CGRectMake(0, naviHeight+realValue(33), WIDTH, realValue(34))];
//
//? ? ? ? for (int i=0; i<3; i++) {
//? ? ? ? ? ? NSString *str = arr[i];
//? ? ? ? ? ? CGFloat bWidth = WIDTH/3;
//? ? ? ? ? ? _typeBtn = [UIButton createButton:CGRectMake(i*bWidth, 0, bWidth, realValue(33)) backgroundColor:RGB(255, 255, 255, 1) title:str target:self action:@selector(typeBtnClick:) font:font(14) titleColor:RGB(60,60, 60,1) tag:i+1];
//? ? ? ? ? ? [_typeBtn setAttributedTitle:[Commen getAttributedStringWithImage:arr[i] imageBounds:CGRectMake(0, 0, realValue(9), realValue(5)) imageName:@"向下箭頭" index:str.length] forState:(UIControlStateNormal)];
//
//? ? ? ? ? ? [_headerView addSubview:_typeBtn];
//? ? ? ? }
//
//? ? }
//? ? return _headerView;
//}
// 返回組頭部view的高度
- (CGFloat)tableView:(UITableView*)tableView heightForHeaderInSection:(NSInteger)section{
? ? return 0;
}