Skip to content

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

License

Notifications You must be signed in to change notification settings

iceyouyou/UUCustomRoot

Repository files navigation

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published