Joel Fischer
Joel Fischer

Reputation: 6597

Storyboard elements are not sized properly on the device

In the storyboard, I am placing a table view element into a subclassed UIView. The element is not appearing on the iPad device I am running it on the same as it appears in the storyboard however. This also happens for additional content that I place into the storyboard. Below is a screenshot as it appears in the storyboard, as well as UI width/height information.

Correct UI

And here is the description of the UI file running on the iPad.

https://gist.github.com/4323186 (embedding it directly into the post is giving me problems)

You'll notice that the tableview is explicitly set at 178 width, and is showing up in the description as 276 width. My initial thought was that perhaps a cell was forcing the parent to be larger (I'm very new to iOS UI development), but drilling into that shows the prototype cell it appears that the width is defined by it's parent at 178. The image views and label also are appearing in the incorrect spot, as shown in the second image below.

Error UI on iPad

Upvotes: 1

Views: 207

Answers (1)

Ryan Artecona
Ryan Artecona

Reputation: 6203

Try turning off all of those Autosizing constraints in the inspector panel for all the rogue views, and carefully adding back the ones you need. With all the constraints on, as in your first screenshot, any change in the parent view's bounds could make those subviews unexpectedly try to readjust.

Upvotes: 1

Related Questions