CTSchmidt
CTSchmidt

Reputation: 1205

MKMapView maximized, but I do not want it

I got an issue and I don't know why I have it and how to fix it! Maybe it is only a simple problem. Here are two screens:

Storyboard Editor iPhone map

There is something missing! Where is the Button? And why is the Map at full screen? It seems a bit strange can anyone help?

Upvotes: 3

Views: 809

Answers (1)

Rob
Rob

Reputation: 437372

This is undoubtedly a function the screen going from a 4" screen when previewing your screen in Interface Builder to a 3.5" inch simulator/device screen.

If using autolayout (open up the storyboard, click on the first tab, the "File Inspector" and see if "Use Autolayout" is checked or not). Check your constraints. The map view should not have a height constraint (or if IB won't let you get rid of it, just drop its priority down to the lowest possible value...though if it adds the height constraint back in, it means that your other constraints are not fully qualified, such as neglecting the button's bottom constraint) but should have either a bottom constraint to the bottom of the screen or, better, to the button. Also make sure that the button's top constraint goes to the map view and that it has a bottom constraint that goes to the super view. Interface Builder makes this process far more complicated than it needs to be in its effort to add what it determines as missing constraints, IMHO, but it can work. It took me 2-3 minutes of fussing with all of the vertical constraints to make sure that they were both unambiguous as well as satisfiable at both screen heights.

If not using autolayout, check your autosizing masks (located on the "Size inspector" tab). You want flexible height and fixed bottom.

In IB you can toggle the appearance of your view from 4.0" to 3.5" by pressing the enter image description here button. Just adjust your autolayout constraints or non-autolayout autosizing masks and then toggle back and forth between 3.5" screen and 4.0" screen to confirm whether everything is configured properly.

Upvotes: 7

Related Questions