1.CGPathCreateCopyByStrokingPath 有什么用?
http://blog.callmewhy.com/2014/10/12/a-hamburger-button-transition/
CGPathRef bound = CGPathCreateCopyByStrokingPath(layer.path, nil, layer.lineWidth, kCGLineCapButt, kCGLineJoinMiter, layer.miterLimit);
layer.bounds = CGPathGetBoundingBox(bound);
CGPathRelease(bound);
2.layer的position相當(dāng)于什么?
“UIView有三個比較重要的布局屬性:frame,bounds和center,CALayer對應(yīng)地叫做frame,bounds和position。為了能清楚區(qū)分,圖層用了“position”,視圖用了“center”,但是他們都代表同樣的值。
frame代表了圖層的外部坐標(biāo)(也就是在父圖層上占據(jù)的空間),bounds是內(nèi)部坐標(biāo)({0, 0}通常是圖層的左上角),center和position都代表了相對于父圖層anchorPoint所在的位置。anchorPoint的屬性將會在后續(xù)介紹到,現(xiàn)在把它想成圖層的中心點就好.