iOS 7: Misplaced View Frame for "Label - Label" will be different at run time

IosIos7StoryboardUistoryboardNslayoutconstraint

Ios Problem Overview


I just finished an app on iOS 6 and bought a developer account a week ago so haven't had much time playing with the iOS 7 SDK. Just downloaded the Golden Master version and trying to upgrade my app to be compatible with iOS 7.

I received a lot of warnings saying

> Misplaced View Frame for "Label - Label" will be different at run time.

and I am unable to run the program. The project contains tableview and its is parsing and displaying XML feed from an RSS.

How to fix this issue?

Ios Solutions


Solution 1 - Ios

The accepted answer will fix the problem, but that's not a good solution because it'll remove all your constraints. If you have spent hours on the constraints then don't do that.

If you click the triangle next to the warning you can get the explanation of what is misplaced. Then you can just move the frame to where it's supposed to be. For example:

enter image description here

In this case I just moved my Text View's y position to 94 and the warning will go away. This is because one of my constraints will force the view to be somewhere else when the app is running, but the position is different than where it currently is in the storyboard.


Another way to move the frame to the right position is to click on the warning next to the View Controller name in your storyboard, and then click on the yellow warning sign, and click update frame.

enter image description here

enter image description here

These two methods are not destructive and will not remove your constraints. If anything it'll show that you may need to do minor readjustments in your constraints.

Solution 2 - Ios

I had the same issue and I get below response form Apple:

> You need to update the constraints to match the frames of these views.

I did the following:

Editor -> Resolve Auto-Layout Issues -> Clear all constraints in ** view controller

then I reordered my objects again in the view.

PS: Try Enrico's solution first.

Solution 3 - Ios

I had the same issue what you need to is , update the constraints or update the frame. On storyboard you have a small tool bar as shown in below image. enter image description here

Please see the meaning:-

enter image description here

You can either choose "Update Frames" or "Update Constraints" and Use "Reset to Suggested Constraints". This will resolve the issue regarding misplaced View. Don’t drag and drop views to make adjustments to layout. Edit the applicable constraints instead. Please , let me know if you not clear.

Solution 4 - Ios

If you are having troubles finding the Update Frames in xCode it can be done like so:

enter image description here

Solution 5 - Ios

None of the answers work in all cases. As of recent version of Xcode, using a UISearchBar, enabling scoping field enabled in IB makes the search field appear double height (but doesn't show a the scoping bar beneath it). Whether or not you add a height constraint (of any height) to the search field, you'll get the warning that it is a misplaced view that will be 88 H at runtime but is 44 H in IB. Updating the frames (any or all frames) doesn't resolve it. Seems like a bug in IB.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAJ112View Question on Stackoverflow
Solution 1 - IosEnrico SusatyoView Answer on Stackoverflow
Solution 2 - IosTarek HallakView Answer on Stackoverflow
Solution 3 - IosSanoj KashyapView Answer on Stackoverflow
Solution 4 - IossiviView Answer on Stackoverflow
Solution 5 - IosclearlightView Answer on Stackoverflow