我有一个 UITableCell 的子类,到目前为止,这是我的代码:
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
voteCount = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.size.width/2, 10, 10, self.frame.size.height)];
voteCount.text = @"24";
[self.contentView addSubview:voteCount];
upVote = [[UIButton alloc] initWithFrame:CGRectMake(self.frame.size.width/3, 0, 20 , self.frame.size.height)];
upVote.titleLabel.text = @"vote";
[self.contentView addSubview:upVote];
}
return self;
}
标签显示,但按钮不显示。我究竟做错了什么?