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];
You might want to set the shouldRasterize
property of your layer to YES
.
This is a follow on from omz's answer to improve the quality of the rasterised layer, to prevent pixelation you need to set the rasterisation scale too.
[self.userView.layer setShouldRaterize:YES];
[self.userView.layer setRasterizationScale:[UIScreen mainScreen].scale];