Reputation: 17591
In my app I have the following configuration to open my view controllers:
When I write "pushViewController" I use a navigation controller, and when I write "present" I use a presentModalViewController
.
firtsView -> (pushviewcontroller) -> secondOneView -> (present) -> thirdOneView -> (present) -> fourthView
firstView -> (pushviewcontroller) -> secondTwoView -> (present) -> thirdTwoView
This is the scheme of my app to organize my view controllers. Then my question is:
What's the way to return from "fourthView" (that is when I go back from "fourthView") to "secondTwoView"?
Is there a way to do it?
Upvotes: 4
Views: 11704
Reputation: 976
If you want some animation. I would suggest to do it manually by using CoreAnimation. Since
-(void)dismissViewControllerAnimated:(BOOL)flag
completion:(void (^)(void))completion;
is only available after iOS5.
Upvotes: 0
Reputation:
Yes there are.
The UIViewController
offers different methods to dismiss a view controller depending on if you presented it modally or not. These are :
-(void)dismissModalViewControllerAnimated:(BOOL)animated; // modal
-(void)dismissViewControllerAnimated:(BOOL)flag
completion:(void (^)(void))completion;
You will need to dismiss them one by one. Also, take time to read the View Programming Guide from Apple.
Using a UINavigationController
you may pop to any view controller using :
-(NSArray *)popToViewController:(UIViewController *)viewController
animated:(BOOL)animated;
Alternatively, another method let you pop just one :
-(UIViewController *)popViewControllerAnimated:(BOOL)animated;
Upvotes: 5
Reputation: 468
if you use presentViewController
i think you have to dismiss viewController one by one
but if you navigationcontroller only, then you can pop to viewController you want
Upvotes: 0