SFSafariViewController

http://blog.csdn.net/xf13718130240/article/details/50549821

以前的时候用来展示网页的方法是webView 或者是iOS8出来的WKwebView,但是webView用来定制很麻烦,WKwebViewBUG又是很多,终于ios9出来了个SFSafariViewController

其实就是个相当于一个内置的safari阅览器,当不想自定义阅览器偷懒时用来很好

第一步

 

#import 

第二步

SFSafariViewController * svc =[[SFSafariViewController alloc]initWithURL:[NSURL URLWithString:@"https://www.baidu.com/"]];
svc.delegate = self;
[self.navigationController presentViewController:svc animated:true completion:nil];

 下面这个代理方法

 

-(NSArray*)safariViewController:(SFSafariViewController *)controller activityItemsForURL:(NSURL *)URL title:(NSString *)title

// 是用来指定DONE按钮功能的就是用来取消这个VIEW

-(void)safariViewControllerDidFinish:(SFSafariViewController *)controller { [controller dismissViewControllerAnimated:YES completion:nil]; }

 

 

 

你可能感兴趣的:(Objective-c)