static NSString *identifiers = @"UITableViewCell";
MyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifiers];
if (!cell)
{
cell = [[MyTableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:identifiers];
}
或者
static NSString *identifiers = @"UITableViewCell";
MyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifiers];
if (!cell)
{
cell = [[[NSBundle mainBundle] loadNibNamed:@"UITableViewCell" owner:self options:nil] lastObject];
}
ios8中
static NSString *identifiers = @"UITableViewCell";
MyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifiers];
直接这样写也可的2.系统自带static NSString *identifier = @"UITableViewCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if (!cell)
{
cell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:identifier];
}