# STCRouter
### how to use
```
pod 'STCRouter'
```
### standard URL format
```
http:\\host[:port][abs_path][:parameters][?query]#fragment
```
### example
```
1.Use STCRouterCenter to register URL format for controller with params, like this:
[[STCRouterCenter defaultCenter].router registerURLFormat:@"router:///root"
toController:[ModalController class] withOptions:[[[STCRouterOption routerOptions] rootIndex:0]
forDefaultParams:@{@"title": @"root"}]];
2.Setup blackList or whiteList, like this:
// 设置路由黑名单
[[STCRouterCenter defaultCenter] addBlackListWithObjects:@[@"com.apple.mobilesafari"]];
// 设置路由白名单
[[STCRouterCenter defaultCenter] addWhiteListInPathWithBIDs:@{@"root": @[@""]}];
[[STCRouterCenter defaultCenter] addWhiteListInPathWithBIDs:@{@"child": @[@"com.stevchen.STCRouter"]}];
Attention:
so, if you add a bundleId into blackList, app with this bundleId cann't open any path in router.
If you add route path with bundleId into whiteList, only app with bundleId in whiteList can open the route.
3.handle undefinded route, like this:
[[STCRouterCenter defaultCenter].router setRouterForward:^(STCRouterParams *routerParams, STCRouterError *error) {
//handle undefinded route
}];
4.open route, like this:
inside app without scheme
[[STCRouterCenter defaultCenter].router openURL:@"/child/user/child/user" withAnimated:YES extraParams:nil];
or outside app with scheme
[[STCRouterCenter defaultCenter].router openExternalURL:@"router:///root"];
or with stack controllers
[[STCRouterCenter defaultCenter].router openURL:@"router:///user/child/root"];
5.intercept route, like this:
NSString *sourceApplication = [options valueForKey:UIApplicationOpenURLOptionsSourceApplicationKey];
BOOL isFilter = [[STCRouterCenter defaultCenter] filterRouterWithUrl:url.absoluteString BID:sourceApplication];
if (!isFilter) {
[[STCRouterCenter defaultCenter].router openURL:url.absoluteString withAnimated:YES extraParams:nil];
}
6.set route from native to hybird, like this:
[[STCRouterCenter defaultCenter].router changeURLFormat:@"router:///child" toHybridUrl:@"http://www.baidu.com"];
you can revert it to native route:
[[STCRouterCenter defaultCenter].router revertFromHybridWithURLFormat:@"router:///child"];
```
妄北y
- 粉丝: 2w+
- 资源: 1万+
最新资源
- 毕设和企业适用springboot智慧交通平台类及物流管理平台源码+论文+视频.zip
- 毕设和企业适用springboot智慧交通平台类及信息管理系统源码+论文+视频.zip
- 毕设和企业适用springboot智慧交通平台类及远程教育平台源码+论文+视频.zip
- 毕设和企业适用springboot智慧交通平台类及虚拟现实体验平台源码+论文+视频.zip
- 毕设和企业适用springboot智慧交通平台类及用户行为分析平台源码+论文+视频.zip
- 毕设和企业适用springboot智慧交通平台类及职业技能培训平台源码+论文+视频.zip
- 毕设和企业适用springboot智慧交通平台类及智能客服系统源码+论文+视频.zip
- 毕设和企业适用springboot智慧交通平台类及智能农场管理系统源码+论文+视频.zip
- 毕设和企业适用springboot智慧交通平台类及自动化测试平台源码+论文+视频.zip
- 毕设和企业适用springboot智慧教育平台类及AR技术平台源码+论文+视频.zip
- 毕设和企业适用springboot智慧交通平台类及智能图像识别系统源码+论文+视频.zip
- 毕设和企业适用springboot智慧教育平台类及共享经济平台源码+论文+视频.zip
- 毕设和企业适用springboot智慧教育平台类及大数据云平台源码+论文+视频.zip
- 毕设和企业适用springboot智慧教育平台类及电子产品维修平台源码+论文+视频.zip
- 毕设和企业适用springboot智慧教育平台类及健康数据分析系统源码+论文+视频.zip
- 5Pin插针设备工程图机械结构设计图纸和其它技术资料和技术方案非常好100%好用.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈