开发者

difference between presentModalView and addSubview?

开发者 https://www.devze.com 2023-01-06 01:29 出处:网络
When revealing a new view, what are the differences between these two and when would you use each? Also, what\'s the right way to nest views. for 开发者_JAVA百科example, I have a UIImageview that ani

When revealing a new view, what are the differences between these two and when would you use each?

Also, what's the right way to nest views. for 开发者_JAVA百科example, I have a UIImageview that animates onto my view and it has a button on it. I want to put that image and the button in their own view, then simply animate the view and have both handled simultaneously.

Thanks!


For the first question :

presentModalView is you show another viewcontroller (called modalViewController) to get some data, temporary view... (more about ModalViewController here) . Generally, it is another view and can hide your original view

addSubview: you add another view in your current screen, you don't show another view. Which means you are still in your current viewController.

For the second question: I will go for presentModalViewController here. You can create another UIViewController contains a UIImageView and 2 buttons then you can just present it

0

精彩评论

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

关注公众号