在iOS 10.0中获取UITableViewCell的所有nil属性

时间:2016-08-16 07:06:17

标签: objective-c uitableview ios10

我在iOS 10中获得了所有属性为nil的单元格,但它在iOS 9.0中运行。我刚拿了一个带有自定义类的单元格,我在viewDidLoad中注册了单元格并在cellForRowAtIndexPath中使用它。

viewDidLoad中

[self.tblVw registerClass:[TaskListCell class] forCellReuseIdentifier:@"TaskassignmentCellForStaff"];

的cellForRowAtIndexPath

TaskListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TaskassignmentCellForStaff" forIndexPath:indexPath];

任何人都可以告诉我应该是什么原因。

感谢。

1 个答案:

答案 0 :(得分:0)

正如Dipen Panchasara所说,如果您使用的是Storyboard,则无需注册Cell。

1)我从零开始制作了一个新的应用程序。

2)创建类TaskListCell

3)创建一个TVC TaskListController 4)无需注册

5)我只是写道:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    TaskListCell * cell = (TaskListCell*) [tableView dequeueReusableCellWithIdentifier:
                                           @"TaskassignmentCellForStaff"
                                                                          forIndexPath:indexPath];
    // Configure the cell...

    return cell;
}

ps代码在这里作为Zip ..随时与我联系。

Xcode 8.0 beta 6