objective c - Getting the frame from a bounding rectangle of UIBezierPath -


i using uibezierpath create shapes display using cashapelayer. however, in order set correct frame of cashapelayer need frame contains uibeziehpath object. according documentation there bounds property. yet, when use layer doesn't contain drawn path. there way convert path.bounds cgrect corresponding correct frame in containing view's coordinate system? have tried

[self convertrect:path.bounds toview:self]  

without success. help.

you can use following:

cgrect pathrect = cgpathgetpathboundingbox(path); 

also, calayer documentation:

the frame rectangle position , size of layer specified in superlayer’s coordinate space. layers, frame rectangle computed property derived values in thebounds, anchorpoint , position properties. when assign new value property, layer changes position , bounds properties match rectangle specified. values of each coordinate in rectangle measured in points.

you can set bounds (which leaves layer position untouched) or set frame (which converted bounds & position).


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -