use*_*883 17 xcode objective-c uitableview
static NSString *cellIdentifier = @"cell";
if (tableView ==tableview1)
{
ContactCustom *cell1=(ContactCustom *) [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell1 == nil)
{
[[NSBundle mainBundle] loadNibNamed:@"ContactCustom" owner:self options:nil];
cell1 = contactCustom;
}
}
Run Code Online (Sandbox Code Playgroud)
如何viewDidLoad在调用cellForRowAtIndex方法之前在方法中注册nib名称?
Gab*_*iel 31
-(void)viewDidLoad
{
[super viewDidLoad];
[self.tableView registerNib:[UINib nibWithNibName:@"cell" bundle:nil]
forCellReuseIdentifier:@"cell"];
}
Run Code Online (Sandbox Code Playgroud)
static NSString *cellIdentifier = @"cell";
if (tableView ==tableview1)
{
ContactCustom *cell1=(ContactCustom *) [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell1 == nil)
{
cell1 = [tableview dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
24406 次 |
| 最近记录: |