Pergunta

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);
Foi útil?

Solução

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.

Outras dicas

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;
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top