How to render viewcontroller in this way using navigation controller
I have 3 view stacks namely MyHomeViewController, MySubViewController, MyReplyListViewController.
Now the MyHomeViewController is the root view. and w开发者_如何学Gohen i give back from MySubViewController it takes me to MyHomeViewController.as like and when i give back from MyReplyListViewController it takes me to MySubViewController using navigation controller
So, MyHomeViewController -> MySubViewController -> MyReplyListViewController
Now what i want is , when user received a new mail in the app.
When user launching the app and if he has received a new reply, i want to show the MyReplyListViewController first, from there when i give back it has to take me to MySubViewController. from there when i give back it has to take me to MyHomeViewController
MyReplyListViewController -> MySubViewController -> MyHomeViewController
This has to happen only once when he has received a new reply.otherwise it has to behave asusaul.
I am trying to accomplish this but no luck
Thanks for your time and support.
Try by using the UINaviationController
viewControllers
property and setViewControllers
method,
@property(nonatomic, copy) NSArray *viewControllers;
- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated;
UPDATED:
For the below controllers.
MyReplyListViewController -> MySubViewController -> MyHomeViewController
You need to create and array of viewControllers in the reverse order shown above.
NSArray* myControllerArray = [NSArray arrayWithObjects:rootViewController, subViewController, replyViewController, nil];
set it as new stack of navigation.
[myNavigationController setViewControllers:myControllerArray animated:NO];
Now go directly to your MyReplyListViewController
.
[myNavigationController popToViewController:replyViewController animated:YES]
精彩评论