Warning frame for “Navigation bar” will be differe

2019-01-10 05:33发布

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 error Frame 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 have Navigation bar. Navigation bar exists for subviews. Anyway I could solve it by tick and untick the checkbox Shows navigation bar in Attributes inspector. But unfortunately every time I reopen Main.storyboard this warning appears again. Also if I click on yellow triangle and then on update frames nothing happen. Any Ideas?

enter image description here

14条回答
可以哭但决不认输i
2楼-- · 2019-01-10 05:43

In Xcode 10 this issue is resolved.

查看更多
姐就是有狂的资本
3楼-- · 2019-01-10 05:44

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

查看更多
小情绪 Triste *
4楼-- · 2019-01-10 05:45

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.

enter image description here

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.

enter image description here

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

查看更多
干净又极端
5楼-- · 2019-01-10 05:47

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:

enter image description here

查看更多
beautiful°
6楼-- · 2019-01-10 05:48

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.

查看更多
7楼-- · 2019-01-10 05:49

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.

查看更多
登录 后发表回答