【发布时间】:2012-06-07 16:28:04
【问题描述】:
我想在我的单元格上设置矩形角。 我实现了
cell.backgroundView = [[UIView alloc] initWithFrame:cell.bounds];
正如this comment 中所建议的那样,但是当我点击单元格时,高光仍然是圆角...我怎样才能摆脱这些?
【问题讨论】:
标签: objective-c ios uitableview
我想在我的单元格上设置矩形角。 我实现了
cell.backgroundView = [[UIView alloc] initWithFrame:cell.bounds];
正如this comment 中所建议的那样,但是当我点击单元格时,高光仍然是圆角...我怎样才能摆脱这些?
【问题讨论】:
标签: objective-c ios uitableview
cell.selectedBackgroundView = [[UIView alloc] initWithFrame:cell.bounds];
【讨论】:
...为了模仿亮点,你应该有
#import <QuartzCore/QuartzCore.h>
CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = cell.bounds;
gradient.colors = [NSArray arrayWithObjects:[[UIColor colorWithRed:0. green:0.545 blue:0.941 alpha:1] CGColor], [[UIColor colorWithRed:0.027 green:0.353 blue:0.878 alpha:1] CGColor], nil];
[cell.selectedBackgroundView.layer insertSublayer:gradient atIndex:0];
它并不完美 - 仍在检查为什么它以纵向绘制越过单元格的右边界,并且在我旋转设备时不横向缩放...
欢迎提出建议。
【讨论】: