Swift: I want add labels as overlay to an Image and then I want to share the Image to Social Network.
This is the code sharing the image to social network ..
@IBAction func share(sender: AnyObject) {
let firstActivityItem = "Text you want"
let secondActivityItem : NSURL = NSURL(string: "http//:www.google.com")!
// If you want to put an image
let image : UIImage = scannedImage.image!
textToImage("gsdghdhfjhfhgdhdh", inImage: scannedImage.image!, atPoint: CGPointMake(20, 20))
let activityViewController : UIActivityViewController = UIActivityViewController(
activityItems: [firstActivityItem, secondActivityItem, image], applicationActivities: nil)
// This lines is for the popover you need to show in iPad
activityViewController.popoverPresentationController?.sourceView = (sender as! UIButton)
// 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 = [
]
self.presentViewController(activityViewController, animated: true, completion: nil)
}