ios - CGContextDrawPath for two inner and outer Rect of different colors -
i using below code in drawrect
cgcontextsavegstate(context); cgmutablepathref outerpath=[self createpath:rect]; cgmutablepathref innnerpath=[self createpath:uiedgeinsetsinsetrect(rect, uiedgeinsetsmake(10.0, 10.0, 10.0, 10.0)]; cgpathclosesubpath(outerpath); cgcontextaddpath(context, outerpath); cgcontextsetfillcolorwithcolor(context, [uicolor colorwithred:249.0/255.0 green:38.0/255.0 blue:1.0/255.0 alpha:1.0].cgcolor); cgcontexteofillpath(context); cgcontextdrawpath(context, kcgpathfill); cgcontextaddpath(context, innnerpath); cgcontextsetfillcolorwithcolor(context, [uicolor colorwithred:50.0/255.0 green:213.0/255.0 blue:1.0 alpha:0.4].cgcolor); cgcontextdrawpath(context, kcgpathfill); cgcontextrestoregstate(context);
but, since using 0.4 alpha inner colour , inner colour becomes brown.
how can have show in below?
i make single rectangle, fill cyan color, , stroke red color. make sure set stroke width size need.
Comments
Post a Comment