新增 MKMapView
迅速
let mapView = MKMapView(frame: CGRect(x: 0, y: 0, width: 320, height: 500))
建議將 mapView 儲存為包含 ViewController
的屬性,因為你可能希望在更復雜的實現中訪問它。
目標 C.
self.map = [[MKMapView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
[self.view addSubview:self.map];