如何自定义activityController Swift

时间:2019-01-02 11:38:20

标签: ios swift customization uiactivityviewcontroller

我正在尝试自定义 UIActivityViewController ,但我真的很困惑如何自定义。

代码:

let image =  UIImage(named: (self.userProfileModel!.userdata?.image)!) ?? #imageLiteral(resourceName: "app_logo_v6-2")
let text = "Discription: \(String(describing: 
self.userProfileModel!.userdata?.descriptionValue)) \n UserName: \(String(describing: self.userProfileModel!.userdata?.name))"
let shareAll = [text, image] as [Any]
let activityViewController = UIActivityViewController(activityItems: shareAll, applicationActivities: nil)
activityViewController.completionWithItemsHandler = { (activity, success, items, error) in
if success == true
  {
SVProgressHUD.showSuccess(withStatus: "SUCCESS")
    }
 }
UIApplication.visibleNavigationController.present(activityViewController, animated: true, completion: nil)
return

输出:

Screen shot

这是我要尝试的操作:

共享个人资料信息

用户名: Sham Dhiman

说明:大家好,您好

UserImage:图片

应用程序名称: ABCD


有人可以向我解释如何解决此问题,我已经尝试解决此问题,但没有结果。

任何帮助将不胜感激。

谢谢。

1 个答案:

答案 0 :(得分:2)

let shareAll = ["Discription: \(String(describing:self.userProfileModel!.userdata?.descriptionValue)) ", " UserName: \(String(describing: self.userProfileModel!.userdata?.name))", image ?? ""]