views:

40

answers:

3

Hi friends,

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

A: 

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

GhostRider
A: 

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
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
A: 

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

Jorge
i am using programmically for calling view controllers
sathish kumar
Use the -(void)loadView instead the viewDidLoad
Jorge
the thing is each time it should refresh so only i keeping first view controller as initializing controller
sathish kumar
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