activityViewController

activityViewController

我使用 UIActivityViewController 来共享数据。
我的代码:

dispatch_async(dispatch_get_main_queue()) { () -> Void in
    let activityViewController : UIActivityViewController = UIActivityViewController(
        activityItems: [text!], applicationActivities: nil)
    // This line remove the arrow of the popover to show in iPad
    activityViewController.popoverPresentationController?.permittedArrowDirections = UIPopoverArrowDirection()
    activityViewController.popoverPresentationController?.sourceRect = CGRect(x: 150, y: 150, width: 0, height: 0)

    // Anything you want to exclude
    activityViewController.excludedActivityTypes = [
        UIActivityTypePostToWeibo,
        UIActivityTypePrint,
        UIActivityTypeAssignToContact,
        UIActivityTypeSaveToCameraRoll,
        UIActivityTypeAddToReadingList,
        UIActivityTypePostToFlickr,
        UIActivityTypePostToVimeo,
        UIActivityTypePostToTencentWeibo
    ]

    self.presentViewController(activityViewController, animated: true, completion: nil)
}
我可以显示短信、电子邮件和笔记,我可以在短信、电子邮件和笔记中添加正文。但是我有一个关于电子邮件的问题:我只在电子邮件中添加正文,但我还想为电子邮件添加主题。我怎样才能做到这一点?

最佳答案

只需像这样将主题的值设置为您的标题:

activityViewController.setValue("This is my title", forKey: "Subject")

10-08 05:38