开发者

Switching Views within UITabBar View

开发者 https://www.devze.com 2022-12-18 10:17 出处:网络
I have created an UITabView application. Each view selected from the bar is a seperate controller with own ni开发者_JS百科b file. I switch between them succesfully.

I have created an UITabView application. Each view selected from the bar is a seperate controller with own ni开发者_JS百科b file. I switch between them succesfully.

In the first view I have two buttons (check out the screenshot). When clicking them I want to switch to another views which are the parts of the current view controller. I use:

[self presentModalViewController:anotherViewController animated:NO];

That switches the view, but hides the UITabBar. How to keep the bar on the screen after the switch?

Switching Views within UITabBar View

Switching Views within UITabBar View

P.S. Sorry for the blurred image. I am not allowed to share to much info.


Well I think you are misusing the modal view controller. For a problem like this I'll say you should put them in a view controller stack using UINavigationController. Instead of making each tab a UIViewController make it a UINavigationController, then you can push and pop view controllers on it, which still show the tab bar.
See http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UINavigationController_Class/Reference/Reference.html


use: tabBarController.selectedViewController = newViewController

edit: UINavigationController is not needed here.

0

精彩评论

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