UITableView 消失的内容 [英] UITableView disappearing content

查看:29
本文介绍了UITableView 消失的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一旦表格视图被触摸,单元格标题(和点击操作)就会消失.我只使用标准表视图单元格并将值存储在数组中.值消失后,表格保持可滚动.有什么想法吗?

As soon as the table view gets touched the cell titles (and on-tap actions) disappear. I only use standard table view cells and store the values in an array. After the values disappear the table stays scrollable. Any ideas?

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

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

    // Configure the cell...
    cell.textLabel.text = [[systeme objectAtIndex:indexPath.row] description];
    cell.backgroundColor = [UIColor clearColor];
    [cell.textLabel setTextColor:[UIColor whiteColor]];
    [cell.textLabel setTextAlignment:NSTextAlignmentCenter];

    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"choseSystem" object:[systeme objectAtIndex:indexPath.row]];
}

推荐答案

表格视图很好.我只是将它的视图作为子视图添加到另一个视图中,而没有保留对实际 UITableViewController 的引用.这就是问题所在.

The table view was fine. I just added its view as a subview to another view without keeping reference to the actual UITableViewController. That was the problem.

这篇关于UITableView 消失的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆