iphone - Open a view in UITabBarController -


I need to open a certain tab in the program in my tab bar.

I have the following method from my UITabBarController:

  self.selectedViewController = myVController;  

that does not work.

What is the correct way to open tabs?

Thank you.

> Update: I tried the following code:

  self.selectedViewController = [[Self view controller] objectAtIndex: 0];  

That opens me a desirable tab (this is being selected), but active view is not being updated. Regarding property, Apple's Docs says:

selected index

In versions of the iPhone OS before version 3.0, this property only shows the indicator of the selected tab bar item. Trying to set this value in a view controller's index that does not appear in the tab bar, rather instead it is managed by more navigation controllers, it has no effect.

Maybe this was your problem?

One possible solution is to use your own UITabBar and handle your own ideas so you can do something like this:

  [Items selected from tabbar set: [tabBar.items objectAtIndex: 1]];  

Just implement the code code> UITabBarDelegate and define this view to get item selection messages and manually switch views. (Although you are using Advanced UITabBarController features it may not be worth your effort.)

  - (zero) tabBar: (UITabBar *) tabBar didSelectItem: (UITabBarItem *) item {}  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -