ios - CAGradientLayer not draw the gradient correctly -
i use cashapelayer draw circle , set mask of cagradientlayer, here code:
cashapelayer *circleshapelayer = [cashapelayer new]; // draw circle path code here... cagradientlayer *gradientlayer = [cagradientlayer layer]; gradientlayer.colors = @[(__bridge id)[uicolor whitecolor].cgcolor, (__bridge id)[uicolor clearcolor].cgcolor]; // self here means uiview gradientlayer.mask = circleshapelayer; gradientlayer.frame = self.bounds; [self.layer addsublayer:gradientlayer];
when run app, display gradient circle, gradient strange.
what want circle @ start point, color white , @ end point color clear color, should this:
but color of circle in simulator screen is:
the color symmetric.
i think problem not set gradientlayer.colors
correctly, how can fix it?
cagradientlayer can not paint gradient along arc. on other hand, mask layer's frame small gradient layer's frame see clear color
Comments
Post a Comment