IOS 读取xib到tabelView
/**每一行显示怎样的ceLl*/ -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { //1.创建cell MJtgCell *cell=[MJtgCell cellWithTableView:tableView]; //2.给cell传递模型数据 cell.tg=self.tgs[indexPath.row]; return cell; }
+ (instancetype)cellWithTableView:(UITableView *)tableView { static NSString *ID = @"tg"; MJTgCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; if (cell == nil) { // 从MJTgCellxib中加载cell
cell = [[[NSBundle mainBundle] loadNibNamed:@"MJTgCell" owner:nil options:nil] lastObject];
}
return cell;
}