cocoa touch - How to reuse CALayer -
i want use cagradientlayer
each of cell backgrounds in custom table scroll view. if allocate cagradientlayer
each cell, scrolling slow, somehow reuse gradient each cell, sort of how can reuse uiimage
in uiimageview
. such thing possible?
gradient = [cagradientlayer new]; gradient.frame = innerview.bounds; gradient.colors = [nsarray arraywithobjects:(id)topcolor.cgcolor, (id)bottomcolor.cgcolor, nil]; //gradient.shouldrasterize = yes; [innerview.layer insertsublayer:gradient atindex:0];
i realized render gradient (renderincontext:
) context using uigraphicsbeginimagecontext()
, reuse image obtained it.
Comments
Post a Comment