0

これは、セルを作成する方法の私のコードです:

- (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 には違いがあります。以下のスクリーンショットをご覧ください。

ここに画像の説明を入力

4

1 に答える 1