0

非常に簡単な初心者の質問があります: この関数で URL も共有するにはどうすればよいですか? 私はいつもすべてに従っていて、それが正しいと思っていますが、うまくいかないようです... よろしくお願いします!

func takeSnapshot(view: UIView) {
    let bounds = UIScreen.mainScreen().bounds
    UIGraphicsBeginImageContextWithOptions(bounds.size, true, 0.0)
    self.view.drawViewHierarchyInRect(bounds, afterScreenUpdates: false)
    let image = UIGraphicsGetImageFromCurrentImageContext()
    UIGraphicsEndImageContext()
    let text = "Text to be shared... #Hashtag"
    let activityViewController = UIActivityViewController(activityItems: [image, text], applicationActivities: nil)
    self.presentViewController(activityViewController, animated: true, completion: nil)
4

1 に答える 1

0

を追加するだけNSURLです:

let bounds = UIScreen.mainScreen().bounds
UIGraphicsBeginImageContextWithOptions(bounds.size, true, 0.0)
self.view.drawViewHierarchyInRect(bounds, afterScreenUpdates: false)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
let text = "Text to be shared... #Hashtag"
let URL = NSURL(string: "http://stackoverflow.com/")!

let activityViewController = UIActivityViewController(activityItems: [image, text, URL], applicationActivities: nil)
self.presentViewController(activityViewController, animated: true, completion: nil)
于 2015-08-26T03:46:29.727 に答える