【问题标题】:UITableViewCell issue. Differences in displaying iOS 7 and iOS 6UITableViewCell 问题。 iOS 7 和 iOS 6 显示的差异
【发布时间】:2013-09-26 15:23:32
【问题描述】:

这是我创建单元格的代码:

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

    if (!cell)
    {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil] lastObject];
    }

    UIImageView * imageView = (UIImageView *)[cell viewWithTag:1];

    imageView.image = [UIImage imageNamed:@"nature.jpg"];

    UILabel *nameLabel = (UILabel *)[cell viewWithTag:2];
    nameLabel.text = @"Some text";

    UILabel *priceLabel = (UILabel*)[cell viewWithTag:3];
    priceLabel.text = [_prices objectAtIndex:indexPath.row];

    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    cell.selectionStyle = UITableViewCellSelectionStyleNone;

    return cell;
}

我从笔尖创建它:

但iOS 7 和iOS 6 有区别,请看下面的截图:

【问题讨论】:

  • 我在 iOS 6 和 iOS 7 上的单元格显示方式也有多个问题。不知道如何修复它们。也许苹果会做一些事情来解决这些问题。分组表在 iOS 7 上的显示方式也不同。有人找到修复方法了吗?
  • @benyboariu 你的问题解决了吗?
  • 不,还没有解决方案。
  • @benyboariu 我已经回答了我的问题,你可以检查一下。也许它会帮助你。

标签: ios6 uitableview ios7 xib


【解决方案1】:

我已经为单元格高度设置了值。默认情况下,我没有使用这种方法,它会导致我上面描述的问题。

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 65.0f;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-29
    • 1970-01-01
    • 2013-10-22
    相关资源
    最近更新 更多