0

I am using 2 views in navigation controller in a tab bar. In that First view controller in navigation should automatically call the second view controller without showing First view controller ( by pushing pushviewcontroller on viewdidAppear).

The issue is when i click on the tab bar on first time it goes to Second view controller without any showing of First view correctly . but when I press the tab bar again it show the First view with transition style(popviewcontroller).

Can anyone suggest me what i have went wrong?

Thanks in advance

Regards, sathish

sathish kumar
  • 1,061
  • 6
  • 16
  • 31

3 Answers3

0

just use call second view controller in -(void)ViewwillAppear:(BOOL)Animated then it not give any problem

GhostRider
  • 1,197
  • 10
  • 19
0

Why would you want to do that?

Add the second view as a subview really, or if you really must put it in viewWillAppear:(BOOL)animated - but calling it every time is really inefficient. But again, why would you want to push a view controller over another view controller?! Why don't you just make the second view controller the root view controller?

Thomas Clayson
  • 29,657
  • 26
  • 147
  • 224
  • 1
    I am using kal calendar in my app. the issue is I have to refresh the page each time by getting the current value and put in NSUserDefault and again calling the root controller to show it. so first view controller as intializing controller. and second controller is showing calendar control – sathish kumar Oct 04 '10 at 08:58
0

If you are using initWithNibName to create your view controllers use the viewDidLoad event instead the viewDidAppear.

Jorge
  • 2,056
  • 1
  • 16
  • 23
  • i am using programmically for calling view controllers – sathish kumar Oct 04 '10 at 09:24
  • Use the -(void)loadView instead the viewDidLoad – Jorge Oct 04 '10 at 09:27
  • the thing is each time it should refresh so only i keeping first view controller as initializing controller – sathish kumar Oct 04 '10 at 09:29
  • 1
    It seems that tapping on tabs call poptorootviewcontroller always. You can use - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController delegate method of the UITabBarController and handle the behavior from here, may be pushing your second controller again before return YES from this method. I don't know how to stop the poptoroot but i think it could be a work around here. – Jorge Oct 04 '10 at 10:00