2

When i try to do a border to a view my view become slow

[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];
4

2 回答 2

2

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

于 2012-04-04T02:56:19.473 回答
1

这是 omz 的回答,以提高光栅化层的质量,以防止像素化,您也需要设置光栅化比例。

[self.userView.layer setShouldRaterize:YES];
[self.userView.layer setRasterizationScale:[UIScreen mainScreen].scale];
于 2013-04-01T02:48:22.227 回答