【问题标题】:iPhone: Removing rounded corners from table view celliPhone:从表格视图单元格中删除圆角
【发布时间】:2011-03-29 09:21:43
【问题描述】:

我的应用程序中有一个表格视图,默认显示圆角。

有什么办法可以去掉圆角。

我有 #import <QuartzCore/QuartzCore.h> 并包含框架。

eve 下面的代码不起作用

 self.clipsToBounds = NO;
 self.table.layer.cornerRadius = 0.0;

任何人都可以提出解决方案吗?

提前致谢

【问题讨论】:

  • 什么不起作用?编译器还是运行时?

标签: iphone tableview rounded-corners


【解决方案1】:

您是否在表格视图中使用UITableViewStyleGrouped?如果是这样,将样式更改为UITableViewStylePlain,单元格将是没有圆角的矩形。

【讨论】:

    【解决方案2】:

    对于 UITableViewStyleGrouped 单元格,您需要更改单元格上的 backgroundView。

    UIView *bg = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 60)];
    bg.backgroundColor = [UIColor whiteColor];
    cell.backgroundView = bg;
    
    [bg release]; // if you're not using ARC
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多