在 iOS 10.0 中获取 UITableViewCell 的所有 nil 属性
Getting all nil properties of UITableViewCell in iOS 10.0
我在 iOS 10 中得到所有 属性 零的单元格,但它在 iOS 9.0 中工作。我刚拿了一个带有自定义 class 的单元格,我在 viewDidLoad 中注册了该单元格,并在 cellForRowAtIndexPath 中使用了它。
viewDidLoad
[self.tblVw registerClass:[TaskListCell class] forCellReuseIdentifier:@"TaskassignmentCellForStaff"];
cellForRowAtIndexPath
TaskListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TaskassignmentCellForStaff" forIndexPath:indexPath];
谁能告诉我应该是什么原因。
谢谢。
正如 Dipen Panchasara 所说,如果您使用的是 Storyboard,则无需 registerCell。
1) 我从头开始制作了一个新应用。
2) 创建 class 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 测试版 6
我在 iOS 10 中得到所有 属性 零的单元格,但它在 iOS 9.0 中工作。我刚拿了一个带有自定义 class 的单元格,我在 viewDidLoad 中注册了该单元格,并在 cellForRowAtIndexPath 中使用了它。
viewDidLoad
[self.tblVw registerClass:[TaskListCell class] forCellReuseIdentifier:@"TaskassignmentCellForStaff"];
cellForRowAtIndexPath
TaskListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TaskassignmentCellForStaff" forIndexPath:indexPath];
谁能告诉我应该是什么原因。
谢谢。
正如 Dipen Panchasara 所说,如果您使用的是 Storyboard,则无需 registerCell。
1) 我从头开始制作了一个新应用。
2) 创建 class 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 测试版 6