#URL Route UrlRoute makes popVC,pushVC,presentVC actions easier and more dynamically, while decoupling VC from VC.
###Feature
- Manage all view-jumping actions in a plist together, which makes changing routes more easier and routes can even be changed dynamically by server.
- Allow sending messages to next VC and callback to the pop VC.
- Can set a view for any error actions for the view-jumping.
- Launch your app via some scheme from a browser, or some other apps.
###Usage
- The window rootView must be
UINavigationController
ViewController *vc = [[ViewController alloc]init];
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
self.window.rootViewController = nav;
All the viewController must be
CurrentViewController's child VC.Setup your personal url map in
SDCUrlRouteConfig.h,SDCUrlRouteFile.plistComplete all the steps above. You can try it, like this:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
switch (indexPath.row) {
case0:
{
[[SDCUrlRouteCenter sharedCenter]open:localRouteUrl(RouteToTestVC) animated:YES];
}
break;
case1:
{
[[SDCUrlRouteCenter sharedCenter]open:localRouteUrl(RouteToTestVC) animated:YESURLRedirectType:kUrlRedirectPresent];
}
break;
case2:
{
NSDictionary *dict = [NSDictionarydictionaryWithObjectsAndKeys:@"hello Test1",@"key", nil];
[[SDCUrlRouteCenter sharedCenter]open:localRouteUrl(RouteToTestVC) animated:YESextraParams:dict];
}
break;
case3:
{
NSDictionary *dict = [NSDictionarydictionaryWithObjectsAndKeys:@"hello Test2",@"key", nil];
[[SDCUrlRouteCenter sharedCenter]open:localRouteUrl(RouteToTestVC) animated:YESURLRedirectType:kUrlRedirectPresentextraParams:dict];
}
break;
case4:
{
[[SDCUrlRouteCenter sharedCenter]open:@"http://www.baidu.com"animated:YES];
}
break;
case5:
{
NSDictionary *dict = [NSDictionarydictionaryWithObjectsAndKeys:@"hello Test1 Call Back",@"key", nil];
[[SDCUrlRouteCenter sharedCenter]open:localRouteUrl(RouteToTestVC) animated:YESextraParams:dict WithReloadBlock:^(id customValue) {
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:nilmessage:customValue delegate:nilcancelButtonTitle:nilotherButtonTitles:@"OK", nil];
[alertView show];
}];
}
break;
case6:
{
NSDictionary *dict = [NSDictionarydictionaryWithObjectsAndKeys:@"hello Test1 Call Back",@"key", nil];
[[SDCUrlRouteCenter sharedCenter]open:localRouteUrl(RouteToTestVC) animated:YESURLRedirectType:kUrlRedirectPresentextraParams:dict WithReloadBlock:^(id customValue) {
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:nilmessage:customValue delegate:nilcancelButtonTitle:nilotherButtonTitles:@"OK", nil];
[alertView show];
}];
}
break;
case7:
{
[[SDCUrlRouteCenter sharedCenter]open:localRouteUrl(@"helloworld") animated:YES];
}
break;
default:
break;
}
}