static NSString *CellIdentifier = @"SampleCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
用xcode 自动生成的TableViewController有时候会是这样子的
static NSString *CellIdentifier = @"SampleCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
这句话好像有问题,我在使用的过程种都会崩溃。改成开头那样子就没问题了。