12345678910111213141516171819202122232425262728293031323334353637383940 |
- #import "RNNNavigationStackManager.h"
-
- @interface RNNNavigationStackManager ()
-
- @property RNNStore *store;
-
- @end
-
-
- @implementation RNNNavigationStackManager
-
-
- -(instancetype)initWithStore:(RNNStore*)store {
- self = [super init];
- self.store = store;
- return self;
- }
-
- -(void)push:(UIViewController*)newTop onTop:(UIViewController*)currentTop animated:(BOOL)animated{
-
- [[currentTop navigationController] pushViewController:newTop animated:animated];
- }
-
-
- -(void)pop:(UIViewController*)vc animated:(BOOL)animated{
-
- if([[vc navigationController] topViewController] == vc ) {
- [[vc navigationController] popViewControllerAnimated:animated];
- }
- else {
- NSMutableArray * vcs = [vc navigationController].viewControllers.mutableCopy;
- [vcs removeObject:vc];
- [[vc navigationController] setViewControllers:vcs animated:animated];
- }
- }
-
-
-
- @end
|