美文网首页
UIActivityViewController ipad崩溃

UIActivityViewController ipad崩溃

作者: __May__ | 来源:发表于2019-03-28 15:02 被阅读0次

    UIActivityViewController在iphone上直接使用如下代码就OK

    
    UIActivityViewController *activityController =
    
        [[UIActivityViewController alloc] initWithActivityItems:activityItems  applicationActivities:nil];
    
       [self presentViewController:activityController animated:YES completion:nil];
    
    

    在ipad上必须通过popoverPresentationController才能弹出UIActivityViewController

    解决办法是 在 presentController 前面加一句

      if ([activityViewController respondsToSelector:@selector(popoverPresentationController)]) {        activityViewController.popoverPresentationController.sourceView = self.view;    }
    

    相关文章

      网友评论

          本文标题:UIActivityViewController ipad崩溃

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