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

泪湿孤枕 提交于 2019-11-27 10:37:57
Kai

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

buildsucceeded

As mentioned here you can fix this by toggling Adjust Scrollview Insets on/off.

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.

This worked for me at Xcode 8.3.1 After restarting Xcode, it would still work.

  1. Select Navigation Controller

  1. Go to Show the Size Inspector

  1. Change Simulated Size to Freeform

  1. Change Simulated Size back to Fixed

  1. Then the warnings disappear.

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 :)

Click "View As" at the bottom left of your storyboard and choose a different device size, then click it again and swap back to the device size you started with. This worked for me.

Until Xcode 8 is patched, you can set the "View as:" option to "iPhone SE" to eliminate the warning. Not ideal, but works for now.

I tried all the above suggestions but it didn't seem to work. I think it might be a more serious bug.

I have logged a bug with Apple Bug Reporter( link: https://bugreport.apple.com/logon) - if you want to do the same, then please reference bug : 31355220 so that Apple can tie it together. The more people that report it - the more information they will have to fix this annoyance.

I was able to get rid of the issue completely by setting the simulated size of the view controller to freeform and then setting the width from 375 to 320.

user2027373

Had the same issue, here's what I did to fix:

Expand the error information and click on the warning detail. Xcode should then automatically open the dimension/position settings. Replace the current value with the value suggested in the warning details.

Basically, make sure that the size in your runtime is the same as the size you have specified in the size inspector.

You can also click the icon beside the image you posted (the yellow triangle with white circle. Sometimes, its a red circle icon) then there will be options to automatically fix/adjust the issues.

I chose the update constraints option then adjusted the new constraints accordingly.

for me the problem was that i was hiding the bottom bar on push (using IB checkbox).

i had to select 'none' in 'bottom bar' option:

Okay so it looks like I've fixed the issue. Here's what I did.

Select update frames like normal. Open a different file and then click back on the storyboard file. If that doesn't work then restart Xcode. It looks like it was updating internally but the interface builder UI was stuck as it sometimes gets.

Please change your device Preview in xcode for View controller and compile and check for warnings...

Xcode 8 is bit buggy, Interface builder reset its with random no which affects all contained views. Try changing your preview device.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!