The document discusses APIs for working with maps and location in iOS apps. It provides examples of how to use the MapKit API to display maps, add pins to locations, and set regions. It also demonstrates using the Core Location API to get the device's current location via GPS, Wi-Fi or cellular data and print the latitude and longitude coordinates. Code snippets are given to import MapKit, create a map view, set the initial region, add annotations for pins, and implement the location manager delegate to handle location updates.
3. English
latitude, longitude
geometrical location represented by y, x position on the earth.
latitude(N-S), longitude(W-E) e.g. 10.787873, 106.685182
embed, include
embed a map in your app.
locate, nail down the position
locate the line where the exception was thrown.
7. MapKit API
import MapKit
@IBOutLet weak var theMap: MKMapView!
// set the location of the landmark.
var dcCenter = CLLocationCoordinate2DMake(10.787873, 106.685182)
// set the span (scale)
var span = MKCoordinateSpanMake(0.02, 0.02)
// set the region to display w/ location and span.
var region = MKCoordinateRegion(center:dcCenter, span:span)
// set the region to the map.
theMap.setRegion(region, animated:true)
8. Annotation (Pin)
// create an instance of pin.
var annotation = MKPointAnnotation()
// set the position of the pin.
annotation.coordinate = landmark
// set the title of the pin.
annotation.title = “DC Center”
// add the pin to the map.
theMap.addAnnotation(annotation)
9. Core Location API (Demo)
Location Manager
how to find out your location? GPS, 3G, Wi-Fi