【发布时间】:2014-09-17 10:43:05
【问题描述】:
有一个 UITableViewCell,我在上面添加了一个标签,标签为 1000。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ChecklistItem"];
UILabel *label = (UILabel *) [cell viewWithTag:1000];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
然后
UILabel *labelName = (UILabel *)[cell viewWithTag:1000]
labelName.text = @"test".
当我跑步时,单元格是空的。有什么建议吗?
【问题讨论】:
-
在您的 cellForRowAtIndexPath 方法中,您指定了 1000 的标签。我假设是错字吗?
-
这只是错误的人,因为我从互联网上复制了这段代码。我们假设标签是 1000 而不是 5000。感谢您的快速回复
-
我看不到您在任何地方添加标签。您只是将 UITableViewCell 转换为 UILabel ,这首先是不正确的..
-
我从 StoryBoard 添加了一个标签并提供了标签号。不正确吗?
标签: ios uitableview uilabel