我建议您将 a 子类UITableViewCell
化并将所有单元格自定义放入其中。它可能类似于以下代码:
CustomCell.h
@interface CustomCell : UITableViewCell
- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier;
@end
CustomCell.m
#import "CustomCell.h"
@implementation CustomCell
- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier];
if (self)
{
// Customization not related to positions and sizes of subviews. For example:
self.detailTextLabel.textColor = [UIColor lightGrayColor];
self.detailTextLabel.text = @"Aaaaaa…";
}
return self;
}
- (void)layoutSubviews
{
[super layoutSubviews];
// Customization related to positions and sizes of subviews. For example:
self.detailTextLabel.frame = CGRectMake(10.0, 10.0, 240.0, 40.0);
}
@end