import UIKit import MapKit//往视图控制器类中引入地图框架 class ViewController: UIViewController, MKMapViewDelegate {//添加地理视图代理协议 override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. let map = MKMapView(frame: self.view.bounds)//初始化一个地图对象,位置和尺寸与根视图一致 map.showsUserLocation = true//在地图中显示当前用户的地理位置 map.mapType = MKMapType.satellite//设置地图视图的显示样式为卫星模式