【发布时间】:2016-03-26 04:23:52
【问题描述】:
我有包含 UITableView 的 XIB,并且在同一个 XIB 中我创建了 UITableViewCell,我没有为单元格设置任何类,我只是为单元格设置了标识符。
现在我想将该单元格加载到 tableview 委托方法 cellForRowAtIndexPath
我做的是:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"SimpleTableItem";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
return cell;
}
但它会创建不包含我创建的 xib 的新单元格。
那么我如何从表格视图具有的同一个 xib 中获取该单元格?
【问题讨论】:
-
我没有为单元格设置任何类,我想使用与表格视图相同的类。@rmaddy
-
我不明白你在问什么?你能问清楚一点吗?
-
Dx Android 看下面的答案。
标签: ios objective-c uitableview