// // UIViewController+HTTP.m // iCemarose // // Created by Sanchew on 2017/7/13. // Copyright © 2017年 kollway. All rights reserved. // #import "UIViewController+HTTP.h" #import <JLRoutes/JLRoutes.h> #import <RegexKitLite/RegexKitLite.h> #import <TOWebViewController/TOWebViewController.h> #import "AppDelegate.h" @implementation UIViewController (HTTP) - (void)openURLWithString:(NSString *)URLString { UIApplication *application = [UIApplication sharedApplication]; NSURL *url = [[NSURL alloc] initWithString:[URLString stringByReplacingOccurrencesOfRegex:@"^https?" withString:@"cemarose"]]; if ([JLRoutes canRouteURL:url]) { [JLRoutes routeURL:url]; // }else if ([application respondsToSelector:@selector(openURL:options:completionHandler:)]) { // [application openURL:[NSURL URLWithString:URLString] options:@{} completionHandler:nil]; } else { // [application openURL:[NSURL URLWithString:URLString]]; TOWebViewController *wv = [[TOWebViewController alloc] initWithURLString:URLString]; [[AppDelegate mainViewController].selectedViewController pushViewController:wv animated:YES]; } } @end