2015-08-26 3 views
0

У меня очень быстрый вопрос начинающих: как я могу использовать эту функцию вместе с URL-адресом? Я всегда слежу за всем и думаю, что я понял, но это не совсем похоже на работу ... Большое спасибо!Share 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) 

ответ

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) 
+0

Я просто получаю один маленький деталь неправильно ... Большое спасибо! –

 Смежные вопросы

  • Нет связанных вопросов^_^