Warning frame for "Navigation bar" will be different at run time appears in Xcode 8 Swift 3
Solution 1
Warning will disappear if you change the property "Simulated Size" to "Freeform".
Solution 2
As mentioned here you can fix this by toggling Adjust Scrollview Insets on/off.
Solution 3
I have changed from View as: iPhone 6S to iPhone 5S, then changed back to iPhone 6S, and Xcode did all the changes to remove the warning.
Solution 4
This worked for me at Xcode 8.3.1 After restarting Xcode, it would still work.
- Select Navigation Controller
- Go to Show the Size Inspector
- Change Simulated Size to Freeform
- Change Simulated Size back to Fixed
- Then the warnings disappear.
Solution 5
As a workaround just to get rid of the annoying warning I have been editing Main.storyboard manually by removing 'misplaced' in:
<navigationBar key="navigationBar" opaque="NO" contentMode="scaleToFill" misplaced="YES" translucent="NO" id="Os1-Xh-7XN">
A hack but it is nice to have zero warnings rather than 1 :)
Danny
Updated on July 08, 2022Comments
-
Danny almost 2 years
Before I've upgraded to
Xcode 8
I haven't seen this error in such case. I have different Navigation Controllers. For all of them I see an errorFrame for "Navigation bar" will be different at the run time. Navigation bar "Expected: width=384, Actual: width=375
. In reality these Navigation Controllers doesn't haveNavigation bar
.Navigation bar
exists for subviews. Anyway I could solve it by tick and untick the checkboxShows navigation bar
inAttributes inspector
. But unfortunately every time I reopenMain.storyboard
this warning appears again. Also if I click on yellow triangle and then on update frames nothing happen. -
Danny over 7 yearsAfter reopening of XCode this warning actually disappears, but if I open any file in the project an the again open
main.storyboard
these warnings appear again -
Ashish Kakkad over 7 yearsThis doesn't solve problem. Close Xcode and Open again the issue will come again.
-
AlessandroDP over 7 years@AshishKakkad And there is! Used to do the same and become normal, but then again it's a warning there...
-
nekonari over 7 yearsThis is bugging the hell out of me.. I just tried this, and this does remove warning temporarily. You can always switch Simulated Size back and forth to remove the warning when it does come back. Super. Annoying.
-
zero3nna over 7 yearsit also just temp fixing it for me
-
Sethmr over 7 yearsWill I have to add this back later? I don't really care what my navigation Controller looks like so long as I don't have warnings. It's kind of funny. The storyboard recognizes the warning for a split second and then it goes away when you enter the storyboard this way.
-
Abdul Waheed over 7 yearsI am USING SE .. but still Warning
-
nekonari over 7 yearsYeah, I know. But they do go away whenever you switch that selection to something else. Nowadays, I start with 7, switch to SE, then back to 7 to clear these warnings. Or just leave them, and just not check
misplaced
properties in when commiting changes. -
buildsucceeded over 7 yearsWow, and (checking git) literally all that happens when you do this is that
misplaced="YES"
gets removed. :/ -
emem over 7 yearsOnly a temporary fix - this is not the answer.
-
Micah Montoya over 7 yearsYou may still see this error if you don't manually change the size to the suggested.
-
Casey Wagner over 7 yearsThat fixes it until the next time your close and reopen the project. Not a complete fix.
-
nodyor90z over 7 yearsSolved my problem. Thanks @Kai
-
bauerMusic over 7 yearsEither change this Simulated Size (and back to 'Inferred' or whatever) or "toggling Adjust Scrollview Insets on/off". Both will cause Storyboard to remove its
misplaced="YES"
. This is an Xcode bug, and this fix is a force-refresh kind. Taken from @buildsucceeded answer. -
Zhao over 7 yearsI did the same thing and then don't touch the storyboard again. Everything works well.
-
Slipp D. Thompson about 7 yearsDoes not work in this situation. The X/Y/Width/Height fields for the Navigation Bar are all grayed-out/uneditable.
-
Slipp D. Thompson about 7 years@Ian Hmmm… I think I just ended up editing the xib so that the numbers matched up.
-
UKDataGeek about 7 years@bauerMusic what do you mean a force refresh kind?
-
bauerMusic about 7 years@MobileBloke By force-refresh I meant that it will cause the Storyboard view to rewrite (refresh) the params, re-evaluate and remove the warning. It's really a refresh, force was only meant that it didn't do it automatically by itself (as it should) and needed some manual arbitrary change.
-
UKDataGeek about 7 yearsMakes sense - I thought there was a magic button . I noticed that storyboard is taking longer to load since this bug started appearing .. you seeing this too ?
-
UKDataGeek about 7 yearsPRoblem is that when you reload it comes back... anyone else noticing that it takes a long time to load the storyboard with the spinner running when this error occurs?
-
UKDataGeek about 7 yearsThis worked for a short time- then after Xcode procesed it again - the same thing happened and the warning re-occured. Is this still working for you on latest Xcode?
-
thetrutz almost 7 yearsYou only need to set it only on the view controllers that have no parents (root view controller + maybe more, depending on what you have in your storyboard)
-
Duck over 6 yearsXcode is a sea of unsolved bugs that continue there, marinating, forever.
-
Efren over 6 yearsI could only make it go away permanently (even after restart) by using the width that appeared in the warning, as the value in the Freeform option.
-
Manganese over 6 yearsAny idea why this would have worked and not "Update frames" button?
-
May Phyu over 6 years@guoc, bro could you help me please stackoverflow.com/questions/46375778/… ?