【问题标题】:Cannot access the Custom UILabel in a Custom UITableViewCell无法访问自定义 UITableViewCell 中的自定义 UILabel
【发布时间】:2012-11-19 16:04:37
【问题描述】:

这是 Nsr(只是 xcoding 的初学者),使用 xcode 4.3.3,

我通过故事板制作了带有自定义 UITableviewcell 的自定义 UITableview, 我的自定义单元格中有一个 UIBUtton 和一个 UILabel 。 我删除了单元格选择(也清除了背景),以便只能访问作为自定义 UILabel 的背景的按钮。

自从使用数据数组以来,现在有一堆按钮,当我单击任何按钮时,它会转到另一个视图(详细视图),我想要的只是设置自定义标签(设置在详细视图上)上一个带有“标签”的选定按钮... 表示新标签 = 上一页在自定义表格视图中单击的标签..

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    Custom *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil) {

        cell = [[Custom alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

    }

    cell.myLabel.text = [myArray objectAtIndex:indexPath.row];

    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    [self.myTable reloadData];

}

我希望你能解决我的问题,非常抱歉我的英语不好.. 请帮助我,我真的一团糟,因为这个问题已经花了我 3 天的时间:( 提前致谢,干杯。

【问题讨论】:

    标签: uitableview uilabel


    【解决方案1】:

    函数返回自定义单元格,但在标题中您编写 UItableviewCell 将其更改为自定义

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-21
      • 1970-01-01
      • 1970-01-01
      • 2017-06-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多