iOS Accessing Maps - IOS

What is iOS - Accessing Maps?

Maps are useful for everyone in locating places. Maps are integrated in iOS using the MapKit framework.

Steps Involved

  • Step 1.We need to create a simple view-based application.
  • Step 2. We need toselect your project file, then select targets and then add MapKit.framework.
  • Step 3. We should also add Corelocation.framework.
  • Step 4.We need toadd a MapView to ViewController.xib and create an ibOutlet and name it as mapView.
  • Step 5.We need tocreate a new file by selecting File-> New -> File... -> select Objective C class and click next.
  • Step 6. Name the class as MapAnnotation with "sub class of" as NSObject.
  • Step 7. Select create.
  • Step 8. We need toupdate MapAnnotation.h as stated below:

  • Step 9. Update MapAnnotation.m as follows −

  • Step 10. Update ViewController.h as follows −

  • Step 11. Update ViewController.m as follows −

Output

When we run the application, we'll get the below result as output −

iOS - Accessing Maps

When we scroll the map up, we'll get the below result as output −

iOS - Accessing Maps

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

IOS Topics