let text = "xxxx"
let image = UIImage(name: "xxxx")
let activityVC = UIActivityViewController(activityItems: [text, image], applicationActivities: nil)
// 如果是ipad, 那么需要使用pop的方式显示方向界面
if DeviceInfo.isiPad {
let popOver = activityVC.popoverPresentationController
popOver?.sourceView = view
popOver?.sourceRect = CGRect(x: 0, y: 0, width: DeviceInfo.screenWidth, height: 340)
}
present(activityVC, animated: true, completion: nil)
网友评论