【问题标题】:Grouped UITableView corner radius default value分组的 UITableView 圆角半径默认值
【发布时间】:2013-06-19 15:33:28
【问题描述】:

我正在自定义一些UITableViewCell 的背景,并且我想设置与它们在表格视图样式分组时默认设置的相同的角半径。 [self.tableView.layer cornerRadius] 给我返回一个 0,谁能告诉我默认值是什么或者我怎么能得到它?

【问题讨论】:

    标签: ios default rounded-corners uitableview


    【解决方案1】:

    首先,你需要导入 QuartzCore:

    #import <QuartzCore/QuartzCore.h>

    对于圆角的事情,你需要做的就是:

    myTableView.layer.cornerRadius = 5;
    

    OR 如果对于单个单元格,在 cellForRowAtIndexPath 中:

    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    

    添加:

    cell.layer.cornerRadius = 5;
    

    【讨论】:

    • 感谢您的回复。我想我没有解释自己,我只是想知道 cornerRadius 的默认值是什么,当您简单地将 tableView 设置为分组时,以便将相同的 cornerRadius 设置为我的自定义单元格
    • 我不认为有默认值.. 它可能是 0。当您调用函数cornerRadius 时,您需要说出数字是多少...就像设置整数一样,您不能只是:[self int] 并期望发生一些事情
    猜你喜欢
    • 1970-01-01
    • 2016-03-28
    • 1970-01-01
    • 2021-12-27
    • 2015-05-15
    • 1970-01-01
    • 2016-07-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多