Jump Any ViewController Easier.
#How to Use
-
Register the
ViewController
.Use the method
+ (BOOL)registerPath:(NSString *)path routeInfo:(NSString *)info;
to register theViewController
with a path.You can register the
ViewController
by follow tow style.- If you use
Xib
.
Set an
identifier
to theViewController
inStoryboard
.Set the
info
param like this:vcClass/1-sbName-vcIdentifier(/paramKeyName)
. The lastparamKeyName
is option. If you need transform something, give aparamKeyName
.- If you don't use
Xib
.
Set the
info
param like this:vcClass/0(/paramKeyName)
. - If you use
-
Route the registered path;
Use the method
+ (void)routePath:(NSString *)path param:(id)param success:(void(^)(UIViewController *viewController))success failure:(void(^)(NSError *error))failure;
to route theViewController
which have registered.The
path
is the key which you set in first step;The
param
is forparamKeyName
.If create
ViewController
succeed, it callssuccess
block. You can user the(UIViewController *viewController)
push
orpresent
。 Else see the(NSError *error)
infailure
.
#TODO
-
Because we can't get the
navigationController
inNSObject
, I use theblock
to give the createdViewController
. You shouldpush
orpresent
theViewController
self.If you have a good idea, open an issue.
-
Don't support the
Xib
withoutStoryboard
.