Ben*_*tto 8 iphone uitableview
我很难过(很可能对一些非常明显的东西视而不见).我有一个UITableView,我想做一些非常正常的事情,比如每行显示文本.为此,我实现了通常的委托方法tableView:cellForRowAtIndexPath:.这是按预期调用的.根据文档,我应该创建一个UILabel对象并将其设置为textLabel新UITableCell上的属性.但我崩溃与无法识别的选择器setTextLabel:- 编译器正式警告我,它不存在.已弃用的方法setText:存在且工作正常(带警告).我肯定似乎建立了3.0库(我在其他目标的下拉中没有选择.所以我很困惑.我错过了什么?
谢谢.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell * cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
UILabel * label = [[[UILabel alloc] init] autorelease];
[label setText:@"Foo."];
[cell setTextLabel:label]; // BOOM.
return cell;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1963 次 |
| 最近记录: |