james_littlefox
james_littlefox

Reputation: 3

How to change SplitView to another view in UITabBarController as in Yelp iPad App

I want to created a view in UITabBarController as the iPad App shown (see image links below [1] [2]), where the default view is a split view and by clicking on "Photo", the split view is replaced as another view. And both views are displayed in the same tab item.

I am able to create split view within tab bar now, which means I can create something like what the first picture shows, but how to replace the split view with another view?

I have tried to assign the UISplitViewController with another UIViewController, but it doesn't work.

As I can't post images, here are the links: http://ww3.sinaimg.cn/large/7811c8e9gw1dphto6x47wj.jpg [1] http://ww3.sinaimg.cn/large/7811c8e9gw1dphtpj1ltaj.jpg [2]

Upvotes: 0

Views: 684

Answers (1)

insyncim64
insyncim64

Reputation: 125

I simply add a UINavigationController in front of the UISplitViewController(between the UITabBarController and the UISplitViewController). When the user toggles the UISegmentedControl, the fullscreen view you need will be pushed onto the UISplitViewController. Here is the storyboard. (But, I can`t paste any photo.)

To access the UINavigationController in the master view or detail view, you can use

[self.splitViewController.navigationController pushViewController:fullScreenViewController animated:YES]; . Since you don`t want the navigation bar of the UINavigationController to appear in the splitView, you need to subclass the UISplitViewController. Then hide the navigation bar in the viewDidApplear:

You can refer to some questions like How to hide the master view or How to display the detail view in a full screen mode. You can also try this customized UISplitViewController MGSplitViewController, which can toggle the master view and detail view in any situation.

Upvotes: 1

Related Questions