If you want to place the aircraft in your current GPS location on Map View, you can set the latitude and longitude values in the Simulator Config to yours.We take the simulator's initial values in the following example. Create a new subclass of MKAnnotation View named "DJIAircraft Annotation View" and a new subclass of NSObject named DJIAircraft Annotation.
Lastly, add a UIButton to the DJIRoot View Controller scene in Main.storyboard, set its IBOutlet name as "edit Btn", and add an IBAction method named "edit Btn Action" for it, as shown below: Once that is complete, open the DJIRoot View Controller.m file, initialize the map Controller and tap Gesture variables, and add the tap Gesture to map View to add waypoints.
Furthermore, we need a boolean variable named "is Editing Points" to store the edit waypoint state, which will also change the title of edit Btn accordingly.
Focusing the map to your current location quickly would be helpful for the application.
To implement that feature, we need to use CLLocation Manager.
Go back to the DJIRoot View Controller.m file, import the DJIMap Controller.h header file, and create a DJIMap Controller property named map Controller.
Since we want to add annotation pins by tapping on the map, we also need to create a UITap Gesture Recognizer named as tap Gesture.
Moreover, we need to implement CLLocation Manager Delegate method to update user Location property.
Finally, we implement the "focus Map Action" method to focus map View to the user's current location.
If the Location Service is not available, we add a UIAlert View to display the warning.
The start Update Location is called in view Will Appear method and is stopped in the view Will Disappear method.
In i OS8, we must call location Manager's request Always Authorization first, which was done in start Update Location method.