这个写成一个category每次调用的时候导入
这种防止重复注册…只注册了一次而且完成了复用
+(id)cellWithTableView:(UITableView *)tableView
{
NSString * className = NSStringFromClass([self class]);
static dispatch_once_t predicate;
dispatch_once(&predicate
, ^{
UINib * nib = [UINib nibWithNibName:className bundle:nil];
[tableView registerNib:nib forCellReuseIdentifier:className];
NSLog(@"dispatch_once");
});
//如果有可重用的返回,如果没有可重用的创建一个新的返回
return [tableView dequeueReusableCellWithIdentifier:className];
}