【问题标题】:Increasing the height of the table view cells default accessory type增加表格视图单元格默认附件类型的高度
【发布时间】:2012-08-09 05:22:38
【问题描述】:

我是 iphone 开发新手。我正在为我的表格视图单元格使用 UITableViewCellAccessoryCheckmark 。我想知道是否可以通过编程方式增加此默认附件类型的高度,或者使用自定义图像是唯一的选择。我想这样做是因为我想为我的单元格设置一个稍大的复选标记。任何帮助表示赞赏

谢谢, 拉吉

【问题讨论】:

标签: iphone objective-c xcode uitableview ios5


【解决方案1】:

复选标记附件类型的大小无法更改.....您可以做的是在UITableViewCell 中添加UIButton 或UIImageview,然后单击执行操作...。图像到单元格相对容易....

【讨论】:

  • 是的,向单元格添加图像很容易。感谢您的快速回复。我会接受您的回答
【解决方案2】:

为此,您必须通过以下教程实现自定义附件类型: link

【讨论】:

    【解决方案3】:

    cellForRowAtIndexPath在这个表格视图方法中使用这个代码

    UIButton *record_Btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    [record_Btn setFrame:CGRectMake(8, 5, 70-20, 35)];
    [record_Btn setBackgroundColor:[UIColor clearColor]];
    [record_Btn setTitle:[NSString stringWithFormat:@"record"] forState:UIControlStateNormal];
    record_Btn.tag = cell.tag;
    [record_Btn addTarget:self action:@selector(pressRecordBtn:) forControlEvents:UIControlEventTouchUpInside];
    [cell.contentView addSubview:record_Btn];
    

    【讨论】:

      猜你喜欢
      • 2021-01-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-23
      • 1970-01-01
      • 2017-10-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多