ios - How To Set CAGradientLayer to CAShapeLayer Without Frame -


hello working core animation , core graphics.i drawing 1 path not rectangle or circle or ellipse cant give frame path.now want set gradient colour path.but need frame,that cant give.here code path :

cgpoint point1 = cgpointmake(120.0f, 50.0f); cgpoint point2 = cgpointmake(240.0f, 150.0f); cgpoint point3 = cgpointmake(360.0f, 50.0f); cgpoint point4 = cgpointmake(480.0f+50/2.0, 100.0f);  cgmutablepathref curvedpath = cgpathcreatemutable(); cgpathmovetopoint(curvedpath, null, 50, 50); cgpathaddcurvetopoint(curvedpath, null, point1.x, 50, point1.x, 50, point1.x, point1.y); cgpathaddcurvetopoint(curvedpath, null, point2.x, 50, point2.x, 50, point2.x, point2.y); cgpathaddcurvetopoint(curvedpath, null, point3.x, 50, point3.x, 50, point3.x, point3.y); cgpathaddcurvetopoint(curvedpath, null, point4.x, 50, point4.x, 50, point4.x, point4.y); cgpathclosesubpath(curvedpath); return curvedpath; 

use cgpathgetpathboundingbox. if gradientlayer sublayer or mask layer of shapelayer, try this:

gradientlayer.frame = cgpathgetpathboundingbox(shapelayer.path); 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -