0

我想设置一个自定义单元格,因此我在情节提要上创建了 CustomDetailCell 类和一个单元格,并在其中创建了 2 个 UILabel。对于标签,我更改了字体和大小,并将自定义类与情节提要上的单元格连接起来。我尝试像这样使用它:

case DetailControllerAddressSection:
{
    CustomDetailCell *customCell = (CustomDetailCell *)[tableView dequeueReusableCellWithIdentifier: @"AddressCell" forIndexPath: indexPath];
    customCell.addresLabel.text = [self.objectData pointSubtitle];
    customCell.distanceLabel.text = [self distanceMessageForObjectData: self.objectData];
    return customCell;
    break;
}

但是在我的单元格上只有一个带有另一种字体的标签(不像在故事板单元格中)

无法理解这个..有什么帮助吗?

PS 单元格的标识符用于情节提要。

编辑:自定义控制器

#import <UIKit/UIKit.h>

@interface CustomDetailCell : UITableViewCell

@property (weak, nonatomic) IBOutlet UILabel *addressLabel;
@property (weak, nonatomic) IBOutlet UILabel *distanceLabel;

@end

#import "CustomDetailCell.h"

@implementation CustomDetailCell

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
}

@end

在此处输入图像描述

4

0 回答 0