Skip to content

UrlRoute in iOS make view-jumping actions easier and more dynamically.

Notifications You must be signed in to change notification settings

campusappcn/iOSUrlRoute

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#URL Route UrlRoute makes popVC,pushVC,presentVC actions easier and more dynamically, while decoupling VC from VC.

###Feature

  1. Manage all view-jumping actions in a plist together, which makes changing routes more easier and routes can even be changed dynamically by server.
  2. Allow sending messages to next VC and callback to the pop VC.
  3. Can set a view for any error actions for the view-jumping.
  4. Launch your app via some scheme from a browser, or some other apps.

###Usage

  1. The window rootView must be UINavigationController
    ViewController *vc = [[ViewController alloc]init];
    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
    self.window.rootViewController = nav;
  1. All the viewController must be CurrentViewController's child VC.

  2. Setup your personal url map in SDCUrlRouteConfig.h, SDCUrlRouteFile.plist

  3. Complete 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) {
        case 0:
        {
            [[SDCUrlRouteCenter sharedCenter]open:localRouteUrl(RouteToTestVC) animated:YES];
        }
            break;
        case 1:
        {
            [[SDCUrlRouteCenter sharedCenter]open:localRouteUrl(RouteToTestVC) animated:YES URLRedirectType:kUrlRedirectPresent];
        }
            break;
        case 2:
        {
            NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"hello Test1",@"key", nil];
            [[SDCUrlRouteCenter sharedCenter]open:localRouteUrl(RouteToTestVC) animated:YES extraParams:dict];
        }
            break;
        case 3:
        {
            NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"hello Test2",@"key", nil];
            [[SDCUrlRouteCenter sharedCenter]open:localRouteUrl(RouteToTestVC) animated:YES URLRedirectType:kUrlRedirectPresent extraParams:dict];
        }
            break;
        case 4:
        {
            [[SDCUrlRouteCenter sharedCenter]open:@"http://www.baidu.com" animated:YES];
        }
            break;
        case 5:
        {
            NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"hello Test1 Call Back",@"key", nil];
            [[SDCUrlRouteCenter sharedCenter]open:localRouteUrl(RouteToTestVC) animated:YES extraParams:dict WithReloadBlock:^(id customValue) {

                UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:nil message:customValue delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
                [alertView show];

            }];

        }
            break;
        case 6:
        {
            NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"hello Test1 Call Back",@"key", nil];

            [[SDCUrlRouteCenter sharedCenter]open:localRouteUrl(RouteToTestVC) animated:YES URLRedirectType:kUrlRedirectPresent extraParams:dict WithReloadBlock:^(id customValue) {

                UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:nil message:customValue delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
                [alertView show];

            }];
        }
            break;
        case 7:
        {
            [[SDCUrlRouteCenter sharedCenter]open:localRouteUrl(@"helloworld") animated:YES];
        }
            break;
        default:
            break;
    }
}

About

UrlRoute in iOS make view-jumping actions easier and more dynamically.

Resources

Stars

Watchers

Forks

Packages

No packages published