UITableViewCell问题。在显示的iOS 7和iOS 6
问题描述:
差异这是我的代码如何创建单元:UITableViewCell问题。在显示的iOS 7和iOS 6
- (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中采取下面的截图来看看:
答
我已经为单元格高度设置了值。默认情况下,我没有使用这种方法,它导致了我上面描述的问题。
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 65.0f;
}
我也有多个单元格显示在iOS 6和iOS 7上的问题。不知道如何解决它们。也许苹果会做一些事情来解决这些问题。分组表在iOS 7中也显示为不同。有人找到了解决方法? –
@benyboariu你解决了你的问题吗? –
不,还没解决。 –