简体   繁体   中英

How to go back to the superview in ios

To view1 I added a sub view (view2). And now I am in view2, Now I wanted to move back to view1. I am using [self.view removefromsuperview] but it is not working.

You aren't supposed to organise your application as views that you add on top of one another. A more typical way of organising your application is to split the different screens into different view controllers and use a UINavigationController to navigate between them.

If you just lump all your code together into a single view controller and manually add and remove views, you're going to get into a mess very quickly. I strongly recommend reading View Controller Programming Guide for iOS .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM