开发者

Showing a view within another view in Xcode

开发者 https://www.devze.com 2023-03-25 05:56 出处:网络
Let\'s say I have three views: A, B, and C. I\'m on view A and there is a button that says \"Show view C\". Now I want when choosing that button for the active view to go to B, and then display view C

Let's say I have three views: A, B, and C. I'm on view A and there is a button that says "Show view C". Now I want when choosing that button for the active view to go to B, and then display view C as a popup on view B. That's the first question. The second questi开发者_运维技巧on: how can I make view C into say a 500x500px popup that I can design in an in XIB file (where this popup will appear over view B)?


It really depends on how your application is designed. IF you have UIViews (I would imagine at least one UIViewController) then you could for instance design view A in interface builder adding view B as a subview (on top of) view A. Then add view C on top of view B. Then set the size and position of view C to 500x500px and move it to where you want it to be on view B. Of course you need to add IBOutlets to your headers and hook each view up to its IBOutlet. Then, the cheap way would be to simply set hidden=YES for the B or B and C views. When the user presses a button, you simply unhide view B and then unhide view C. If you used UIViewControllers and had a UINavigationController, you could set A's view controller as the root view controller and simply push B's view controller. Then from B you could presentModalViewController. It really depends on how your application is designed.

0

精彩评论

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

关注公众号