迅速
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];