一个UITableViewCell中的两个按钮

时间:2011-05-12 14:30:11

标签: ios4 uitableview

如何在Apple App Store中将两个按钮放在一个UITableViewCell中(如此示例)?

enter image description here

1 个答案:

答案 0 :(得分:6)

if ([cell.contentView viewWithTag:kButtonTag] == nil) {

    UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    btn1.tag = kButtonTag;
    UIButton *btn2 = btn1;
    [btn1 setTitle:@"Tell a Friend" forState:UIControlStateNormal];
    [btn2 setTitle:@"Report a Problem" forState:UIControlStateNormal];
    btn1.frame = CGRectMake(0, 0,100,40);
    btn2.frame = CGRectMake(120, 0,100, 40);
    [cell.contentView addSubview:btn1];
    [cell.contentView addSubview:btn2];
    [cell setBackgroundColor:[UIColor clearColor]];

}

更改周围的帧,它应该看起来很相似。

相关问题