iceyouyou / UUCustomRoot

[iOS][Category]Make UINavigationController can pop back to any specified UIViewController in it's stack. #使UINavigationController可返回到指定的某一层UIViewController

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UUCustomRoot

A category that makes UINavigationController can pop to any specified UIViewController in it's stack.

Usage

For example, think a UINavigationController stack like this. Currently [cViewController] is Showing on the screen.
How can we pop back to [aViewController]?

----------------------
| cViewController    | <-- showing UIViewController
----------------------
| bViewController    |
----------------------
| aViewController    | <-- pop back
----------------------
| rootViewController |
----------------------

Import header file in [aViewController] and [cViewController]:

#import "UINavigationController+UUCustomRoot.h"

Implement isCustomRootViewController method in [aViewController]:

- (BOOL)isCustomRootViewController {
	return YES;
}

Pop back to [aViewController] by using popToCustomRootViewControllerAnimated method in [cViewController]:

[self.navigationController popToCustomRootViewControllerAnimated:YES];

License

UUCustomRoot is available under the MIT license. See the LICENSE file for more info.

About

[iOS][Category]Make UINavigationController can pop back to any specified UIViewController in it's stack. #使UINavigationController可返回到指定的某一层UIViewController

License:MIT License


Languages

Language:Objective-C 100.0%