与QuartzCore建立边界很慢?

时间:2012-04-04 02:46:28

标签: iphone cocoa-touch ipad uikit quartz-core

当我尝试为视图设置边框时,我的视图变慢了

[self.userView setBackgroundColor:[UIColor whiteColor]];
[self.userView.layer setMasksToBounds:YES];
[self.userView.layer setCornerRadius:15.0f];
[self.userView.layer setBorderColor:[UIColor lightGrayColor].CGColor];
[self.userView.layer setBorderWidth:1.0f];

2 个答案:

答案 0 :(得分:2)

您可能希望将图层的shouldRasterize属性设置为YES

答案 1 :(得分:1)

这是omz提出的改善光栅化图层质量的答案,以防止像素化也需要设置光栅化比例。

[self.userView.layer setShouldRaterize:YES];
[self.userView.layer setRasterizationScale:[UIScreen mainScreen].scale];