开发者

showing a subview in another view at given point on the screen with animation

开发者 https://www.devze.com 2022-12-25 04:53 出处:网络
I would like to make a subview appear at a requested point on screen. ex: i tap at (200,200) , my subview appears with animation under the point tapped. i know how to get the point , but开发者_如何学运

I would like to make a subview appear at a requested point on screen. ex: i tap at (200,200) , my subview appears with animation under the point tapped. i know how to get the point , but开发者_如何学运维 I don't know how to make this subview appear right there at that point.

Thanks!


If you know the point, you can use it to set your subview's frame or center property, depending on what you see fit. In the first case you will have to calculate the frame, in the latter (setting the subview's center to the point) its center will be where the touch occurred:

CGRect theFrame = mySubview.frame;
theFrame.origin = thePoint;
mySubview.frame = theFrame;

or

mySubview.center = thePoint;
0

精彩评论

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

关注公众号