IOS map Development Summary

Source: Internet
Author: User

IOS map Development Summary

First, the main types used for ios map development are as follows:

MKMapView: map control. It can be used when it is dragged in without any other labels. It is used to display the map content, you can zoom in, zoom out, drag, or rotate a map;
CLLocationCoordinate2D: coordinates, including longitude and latitude;
MKCoordinateSpan: Map span, indicating a map magnification. The smaller the value, the finer the unit displayed on the map;

CLLocationManager: The management class of the user's location. This class can be used to obtain the GPS coordinates of the user.


Below we will share with you some of the knowledge involved in the map part of my personal projects, which are all entry-level. Please bypass this:

1. Map Display

The Map Display captures two elements: the center coordinate point and the map span. If the coordinate center is (0, 0) and the span is (8, 6), the display range of the map is [-4,-3] to [4, 3]. The Code is as follows:

// Set the center coordinate point CLLocationCoordinate2D curLocation; curLocation. latitude = 23.9098099; curLocation. longpolling = 112.980980; // set the map span MKCoordinateSpan span; span. latitudeDelta = 0.008; span. longitudeDelta = 0.008; // display the map MKCoordinateRegion region = {curLocation, span}; [self. mapView setRegion: region animated: NO];
As shown in the Code, after setting the central coordinate point and map span, call setRegion to display the map. The animated parameter indicates whether to use an animation when displaying the map.

2. Positioning

How can we get our current location and display it on a map?

The CLLocationManager mentioned above is used in three steps.

Step 1: Enable the app positioning function:

If (self. locationManager = nil) {self. locationManager = [[CLLocationManager alloc] init]; self. locationManager. delegate = self; self. locationManager. desiredAccuracy = kCLLocationAccuracyBest; self. locationManager. distanceFilter = 1000.0; NSLog (@ "response

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.