Warning Frame for "Navigation Bar" Will Be Different at Run Time Appears in Xcode 8 Swift 3

Warning frame for Navigation bar will be different at run time appears in Xcode 8 Swift 3

Warning will disappear if you change the property "Simulated Size" to "Freeform".

Sample Image

Xcode 8 Frame for Navigation Bar will be different at run time error

Warning will disappear if you change the property "Simulated Size" to "Freeform".

Sample Image

Frame for will be different at run time in swift

Your constraints are probably set correctly, since you're getting just a warning.

  1. Go to your Storyboard an look in your Document Outline for the yellow triangle
    Document Outliner warning

  2. Click on it so that it displays all Misplaced views
    Show misplaced views

  3. Make sure that Update frames is selected and click fix misplacement (you can also check the "Apply to all views in container" if you have lot of misplaced views and want to reposition it in single click)
    Update frames

Xcode 8 / Swift 3 / ios 10 navigation bar changes?

Through some insane trial and error in viewDidLoad() I found why this error occurs:

If I create the button with an empty title I get the problem, i.e. like this:

outletCatalogNav.leftbarButtonItem = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.plain, target: self, action: #selector(ownCatalogBackButton));

Create with a non-empty title and it works:

outletCatalogNav.leftbarButtonItem = UIBarButtonItem(title: "test", style: UIBarButtonItemStyle.plain, target: self, action: #selector(ownCatalogBackButton));

In both cases the title is actually also set later - but what matters is having a non-empty title when creating the button.

Copied a View to a project with Navigation Controller - Frame for Image View will be different at run time

Select the UIImageView and click [-o-] icon, then choose Reset To Suggested Constraints menu item.
Simulated metrics section does nothing in the runtime, it only us to figure out how layout will look like before compiling.

Also there is one more (better) approach, but you have to analyse what constraints UIImageView has and change them accordingly for new layout (with added nav bar). You can try to post screenshot with those constraints here, so we can help you to figure out what happened. Go to Size Inspector in right panel and show us Constraints section.

UPDATE

Your constraints force UIImageView to have the same horizontal align as labels below have and the same width. Plus you have constraints for fixed vertical space from the topmost label and navigation bar, width of UIImageView depends on available space between nav bar and labels. I think it's good solution for current layout (without scrolling), because everything will fit into the screen for both 3.5" and 4" inch displays. In case you want different behaviour let me know in a comments.

How to Remove the Warning Frame for Button will be different at run time.

Probably you have created a conflict in constraints. To resolve it
Open nib file Go to editor > Resolve all constraint issues> from there you can reset all/desired constraints.



Related Topics



Leave a reply



Submit