开发者

how do i turn a cgpoint into a cgrect or how can i set a calayer's center?

开发者 https://www.devze.com 2023-03-12 08:47 出处:网络
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 fra

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号