문제

I have white background and white label on it, so I need to give a shadow all side of characters I use this code and it works! but it cause to slowly scroll do you have any idea how can solve this problem?

cell.L_name.layer.shadowOpacity = 1.0;
cell.L_name.layer.shadowRadius = 1.0;
cell.L_name.layer.shadowColor = [UIColor blackColor].CGColor;
cell.L_name.layer.shadowOffset = CGSizeMake(1.0, 1.0);
도움이 되었습니까?

해결책

try setting

cell.L_name.layer.shouldRasterize = YES;

this will render your label as a bitmap and might improve scrolling smoothness

additionally you could set

cell.opaque = YES;

which will optimize drawing performance as well.

다른 팁

Setting a shadowPath for the layer would probably increase the performance greatly.

cell.L_name.layer.shadowPath = [UIBezierPath pathWithRect:L_name.bounds].CGPath;

Besides, you can cache the generated shadow as a bitmap, which also increases the performance considerably. Do not forget to set rasterizationScale for retina displays.

cell.L_name.layer.shouldRasterize = YES;
cell.L_name.layer.rasterizationScale = [UIScreen mainScreen].scale;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top