skip to Main Content

I have a question to ask.
In my app, I have collected user location from GPS. I have also used Google Maps to show this location on a map.
What I need now is to save a picture on this location on my map and post it on Facebook. More or less the same thing Runtastic does.
Can someone help me doing this?
I have GPS location, then I have to build a map using Google Maps Api, then take a picture of it and post it on Facebook as a link, for example.
I hope this is clear enough for you.
Thank you very much.

2

Answers


  1. You can take a screenshot of the screen using the this method. In UIGraphicsBeginImageContextWithOptions you can set the rect of the Google Maps window.

    Using the Facebook SDK you can share the image.

    Login or Signup to reply.
  2. This is the code for taking a screenshot of a particular view

    Swift 3.x code

     UIGraphicsBeginImageContext(self.mapView.frame.size)
     self.mapView.layer.render(in: UIGraphicsGetCurrentContext()!)
     let image = UIGraphicsGetImageFromCurrentImageContext()
     UIGraphicsEndImageContext()
    
     // I used this on a imageView
     imageView.image = image
    

    My imageView is just above the button.

    Check my output
    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search