The app I am developing uses a tab bar with a Map View. The problem is the tab bar blocks out the Google Maps logo at the bottom left hand corner. How do I set the height and width of the Map View to ensure that the Google logo is visible? I've tried adjusting the Map View on IB but the size doesn't seem to change as the logo is still blocked from view. Can anyone help?
A:
You can always set the frame programmatically.
//create a map view to talk about, though you're probably getting it via your .xib
MKMapView *map = [[MKMapView alloc] init];
map.frame = CGRectMake(0, 0, 320, 300); //that's x, y, width, height
You'd probably want to do that in -viewDidLoad
.
Dan Ray
2010-07-01 12:14:07
Yes, that works nicely - Thanks! Although I did it slightly different:mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, 320, 367)];I wonder why it doesn't work when I do it via IB - would u know why? Nevermind, just curious that's all.
leeks
2010-07-02 11:48:55
I've had cases when IB stuff doesn't account for the context of the view I'm constructing. I often have to go back and rejigger heights to make things line up. BTW, the reason I demonstrated it as a two-line thing is, you CAN instantiate it as part of the nib, and then set its frame separately. If you're building a complex layout in IB and certain pieces are misbehaving, feel free to push it around in the code after it's loaded.
Dan Ray
2010-07-02 12:03:22
Thanks Dan for the tip on setting the frame separately :)
leeks
2010-07-06 04:05:11