小编CW0*_*007的帖子

没有重用表单元格的索引路径

这开始发生了.任何想法:代码:

CUSTOMCLASSNAME(我已经替换了实际的类名,因为它包含客户端的名称.)

初始化我的tableView:

[self.tableView registerClass:[CUSTOMCLASSNAME class] forCellReuseIdentifier:[self reuseIdentifier]];
Run Code Online (Sandbox Code Playgroud)

在行的单元格中:

嗨,标题正在控制台中打印.这是我的cellForRow:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    AVTCheckListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[self reuseIdentifier] forIndexPath:indexPath];

    [self configureCell:cell atIndexPath:indexPath];

    return cell;
}

- (void)configureCell:(AVTCheckListTableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
    ChecklistGroup *group = [self.checklistFetchedResultsController.fetchedObjects objectAtIndex:indexPath.section];

    ChecklistItem *item = [self getChecklistItemForIndexPath:indexPath];

    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    [[cell cellTextView] setAttributedText:[[item checked] boolValue] ? [[NSAttributedString alloc] initWithString:[item name] attributes:@{ NSStrikethroughStyleAttributeName : @(NSUnderlineStyleSingle) } ] : [[NSAttributedString alloc] initWithString:[item name]]];
    [[cell cellTextView] setUserInteractionEnabled:[[group isUserDefined] boolValue]];
    [[cell cellTextView] setTag:indexPath.row];
    [[cell cellTextView] setDelegate:self]; …
Run Code Online (Sandbox Code Playgroud)

reusability tableview tableviewcell ios

16
推荐指数
4
解决办法
2万
查看次数

iOS 自动布局两个 UIViews 以具有相等的宽度

我有两个视图,v1 和 v2,它们在 UIView 中水平对齐。我希望视图具有相等的宽度。所以我在自动布局中选择 pin 菜单并选择宽度约束。然后我转到“解决自动布局问题”菜单并单击“更新框架”,但这样做只会使我的视图 v1 和 v2 消失。有谁知道我如何让我的视图具有相等的宽度?为了进行比较,在 android 中,我会将视图放置在水平线性布局中,并将它们的权重都设为 1。

storyboard uiview ios autolayout

2
推荐指数
1
解决办法
3417
查看次数