I am trying to add a MKMapView dynamically to the UIView. I have the following code:
self.mapView = [[MKMapView alloc] initWithFrame:self.contentView.frame)];
The above does not completely fill the UIView with the MKMapView but the following works perfectly.
self.mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height)];
What is the value of
self.contentView.frame.origin? Chances are it is not (0,0), unless contentView itself is at the upper-left corner of its superview.You should probably use
self.contentView.boundsinstead, anyway.