how do i turn a cgpoint into a cgrect or how can i set a calayer's center?
i want to align my CALayer to be centered around a point that i get, but im not really that familiar with calayers, dont think they have a center property, ive had some luck with setting the whole frame but i only am given a point to开发者_如何学JAVA do my positioning. any ideas on either how to get the rect from a point or better yet set the layers center?
thanks
Nick
You can use the position
property. It depends on the anchorPoint
property which defines where the it lies w.r.t to the frame. By default, anchorPoint
is at the center of the frame and so position
can be treated as the center of the frame. Unless you change the anchorPoint
, you can use the position
property. To be sure, read both of them in the documentation.
精彩评论