美文网首页
SFSafariViewController

SFSafariViewController

作者: LetBe | 来源:发表于2018-10-22 15:06 被阅读0次

    因为做隐私政策的加入 ,才看到的 ~~尴尬

    现在iOS 9中 增加了一个新的API:SFSafariViewController

    1.导入

    import <SafariServices/SafariServices.h>

    2.使用

    NSURL *url = [NSURL URLWithString:item.url];
    SFSafariViewController *safariVc = [[SFSafariViewController alloc] initWithURL:url];
    

    // [self.navigationController pushViewController:safariVc animated:YES];

    // 官方推荐我们用modal的形式
    [self presentViewController:safariVc animated:YES completion:nil];
    

    3、SFSafariViewController的delegate方法

    pragma mark - SFSafariViewControllerDelegate

    /**
    点击了SFSafariViewController控制器试图 顶部左边的 Done 按钮
    */

      - (void)safariViewControllerDidFinish:(SFSafariViewController *)controller
    
     {
         //[self.navigationController popViewControllerAnimated:YES];
     }
    

    尤其是 最近上架的时候 需要弹出个隐私协议啥的 都是通过这个加载出来的!

    相关文章

      网友评论

          本文标题:SFSafariViewController

          本文链接:https://www.haomeiwen.com/subject/hydgzftx.html