我使用共享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")