Force a view change from a button when using UITabBarController
Posted
by user342197
on Stack Overflow
See other posts from Stack Overflow
or by user342197
Published on 2010-05-16T03:10:52Z
Indexed on
2010/05/16
3:20 UTC
Read the original article
Hit count: 296
iphone
|uitabbarcontroller
Hello -
When using a UITabBarController, when the user enters some data on View1 and presses a button, I need to perform some calculations and present the results on View2.
I have an AppDelegate, View1Controller, View2Controller, and View3Controller (View3 is a basically static view). My AppDelgate declares UITabBarController *rootController;
On View1, I have the calculations being performed in an IBAction for buttonPressed; however, I can't seem to force the view to switch to View2 programmatically.
I have done a lot of searching for similar problems, and think I should be doing something like "self.rootController.selectedIndex = 1"; however,when I do this from within buttonPressed on my View1Controller, I get an error "request for member rootController in something not in a structure or union".
I think I'm missing something basic here... probably need do do something with my AppDelegate, but I'm banging my head against the wall.
Can anyone provide some guidance in this situation...like key things I should do in View1Controller header and implementation with reference to my AppDelgate? Thank you!
© Stack Overflow or respective owner