ios - Getting issue in CGPath Scale -
i drawing polygon using cgpath , adding cashapelayer .i want scale cgpath when user click on it. know how scale cgpath . when click cgpath , cgpath drawing far centre while drawing polygon in centre. cgaffinetransform scaletransform = cgaffinetransformmakescale(scalefactor, scalefactor); cgpathref oldpath = polygonlayer.path; cgpathref scaledpath = cgpathcreatecopybytransformingpath(oldpath, &scaletransform); polygonlayer.path = scaledpath; the problem you're used uiview transformation, done center of view. cgpath transformation done on points (imagine cgpointzero center of path). solution: translate cgpointzero , scale , , original coordinates. cgpathref cgpath_ngcreatecopybyscalingpatharoundcentre(cgpathref path, const float scale) { cgrect bounding = cgpathgetpathboundingbox(path); cgpoint pathcenterpoint = cgpointmake(cgrectgetmidx(bounding), cgrectgetmidy(bounding)); cgaffinetransform translatea...