iOS

iOS Accessing Maps

iOS Accessing Maps

You can always rely on maps to help us find your way around. The MapKit framework is used to incorporate maps in iOS.

Following are the Procedures Involved:

Step 1: Make a straightforward view-based application

Step 2: Add MapKit.framework after selecting your project file, targets, and targets

Step 3: Corelocation.framework should also be added

Step 4: Create an ibOutlet called mapView and add a MapView to ViewController.xib

Step 5: Create a new file by selecting File → New → File... → select Objective C class and click next

Step 6: MapAnnotation is the name of the class, and "subclass of" is NSObject

Step 7: Choose the option to create

Step 8: Make the following changes to MapAnnotation.h:


Step 9: Make the following changes to MapAnnotation.m:


Step 10: ViewController.h should be updated as follows:

Step 11: ViewController.m should be updated as follows:



Output

When you execute the application, you'll obtain the following results:


When you scroll up the map, you obtain the result displayed below:


Top course recommendations for you

    Introduction to JavaScript
    3 hrs
    Beginner
    87.5K+ Learners
    4.45  (3788)
    Data Structure & Algorithms in Java for Intermediate Level
    4 hrs
    Intermediate
    14.4K+ Learners
    4.48  (1984)
    Building Games using Java
    2 hrs
    Beginner
    26K+ Learners
    4.27  (151)
    Algorithms in C
    3 hrs
    Beginner
    26.3K+ Learners
    4.44  (579)
    Angular7 for Beginners
    3 hrs
    Beginner
    19.1K+ Learners
    4.54  (650)
    Angular7 for Intermediate Level
    3 hrs
    Intermediate
    8.5K+ Learners
    4.59  (215)
    Introduction to Kubernetes
    2 hrs
    Beginner
    6.8K+ Learners
    4.29  (252)
    Angular7 for Advanced Level
    3 hrs
    Advanced
    9.6K+ Learners
    4.62  (229)
    Java Algorithms
    2 hrs
    Intermediate
    19.1K+ Learners
    4.49  (419)
    Visual Studio Online
    1 hrs
    Beginner
    13K+ Learners
    4.4  (463)