简体   繁体   中英

Three UIViewControllers on the same window

I want to develop the following application: on top I have a navigation bar, in the middle a TableViewController and on the bottom I have a custom control that is actually a slider (when I move the slider I want to present another TableViewController - but my navigation bar remains the same). And when I select a cell in the TableView I want to push a new ViewController (so I will change my navigation bar) and I will also dismiss my custom control. I have attached a picture of the prototype of my application.How would you suggest that I should implement this? My custom control is designed using IB so I think I should use the old way, using .xib files, not the Storyboard. 在此处输入图片说明

Do you really mean separate view controllers? Everything you've described could be handled with views, in a way that's compatible with all recent versions of iOS

If you really want the 3 parts of your screen to use separate view controllers, you can really only do that under iOS 5 (or later). Starting with iOS 5, view controllers can contain other "child" view controllers. You can create your own container view controller.

Look at the method addChildViewController: to set up view controllers as children of hte current view controller. You add all your children first, and then add their content views as subviews of the parent view controller.

It sounds to me like you would want a navigation controller who's root view controller is a container view controller with multiple child view controllers. If you want to swap out one of the children, use transitionFromViewController:toViewController:duration:options:animations:completion: to switch child view controllers.

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