iOS swift ipad使用系统自带分享 弹框失败没有弹框

 

是因为iOS13上的不支持适配

let activity = UIActivityViewController(activityItems: [URL(fileURLWithPath: path)], applicationActivities: nil)
        
        activity.excludedActivityTypes = [.print]
        
        //需要做一个 iPhone 和 iPad的判断
        if UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiom.pad {
            activity.modalPresentationStyle = .popover
            activity.popoverPresentationController?.sourceView = self.view
            activity.popoverPresentationController?.sourceRect = CGRect(x: Screen.width, y: Screen.height/2, width: 0, height: 0)
            activity.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection(rawValue: 0)
        }
        self.present(activity, animated: true, completion: nil)

 

iOS swift ipad使用系统自带分享 弹框失败没有弹框

上一篇:Jenkins 打包 Android


下一篇:Linux学习笔记(一)