#pragma cell的內容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
TableViewCell *cell;
//定義CustomCell的複用標識,這個就是剛纔在CustomCell.xib中設置的那個Identifier,一定要相同,否則無法複用
static NSString *identifier =@"Cell";
//根據複用標識查找TableView裏是否有可複用的cell,有則返回給cell
cell = (TableViewCell*)[tableView dequeueReusableCellWithIdentifier:identifier];
//判斷是否獲取到複用cell,沒有則從xib中初始化一個cell
if (!cell) {
//將Custom.xib中的所有對象載入
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"TableViewCell" owner:nil options:nil];
//第一個對象就是CustomCell了
cell = [nib objectAtIndex:0];
}
return cell;
}