I had a project in Swift 3.2 that I converted to swift 4 in Xcode 9.3. After the successful migration, I got few Auto Layout Localization warnings that I fixed. My issue is that though I keep seeing such warnings in Issue Navigator and Auto Layout pane in Interface Builder shows yellow warning button, when I tap on it, I see no AutoLayout issues (See images below).
There are weird IBDesignables issues (above image) as well that some people on SO linked to cocoapod bug and workarounds but none have worked for me so far.
Moreover, my UI elements are not rendered at all. Only it marks their position and shows constraints. Please refer to the right pane. "Male Button" is not rendered at all. This doesn't happen for all view controllers in the storyboard but very annoying for few of them.
Because your bundle refer to many view in swift 4 xcode 10.
So please manually choose your view that you're referring.
you can try:
https://stackoverflow.com/a/56128426/4395342
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.
Warning will disappear if you change the property "Simulated Size" to "Freeform".
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.
Select Navigation Controller
Go to Show the Size Inspector
Change Simulated Size to Freeform
Change Simulated Size back to Fixed
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.
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.
Xcode 12
I think this problem is mostly because the width of device preview is different per various devices. E.g. iPhone 12 and iPhone 11 have different screenWidth. If you set a fix value on width of some view and give it some constraints, then it may not adopt your current previewed iPhone's screen width, so it complained "different size in run time".
And for me, I set an UIView and ImageView's width & height as fixed value in size inspector with iPhone 11 preview. And gives it also fixed 10 points leading and trailing constraints in IB. Then it complained if I switch to iPhone 12 preview.
To fix it, I select the viewController and chose "Update Frames". Then it looks better but Xcode still complain one conflict constraint after the change. Eventually, I manually found and fix it in IB.
I have an existing iPad portrait mode app (XCode 7.1) that I am trying to add landscape mode to. I am trying to follow one of Ray Wenderlic's outdated (2013) tutorials for using Auto Layout.
At one point, he says:
Hold down the ⌘ key while you click on the two views on the top (the green and yellow ones), so that both are selected. From Xcode’s Editor menu, select Pin\Widths Equally:
which doesn't exist in the Editor menu. I have looked in SO and Google and found nothing regarding XC 7.1 and pinning. So how do I pin objects in XCode 7.1?
You can use bottom toolbar in Interface Builder. Click "Pin" -> check "Equal Width" -> "Add Constraints".
Screenshot:
Hi i switched to xcode 7 recently, and as usual some starting problems arises when switching to new ides.
The screen width and height of my app is still set for iphone 5 when am actually running it on iphone 6. This was not happening in xcode 6 it used to render properly for both phone models.
You can see the tab bar buttons ending little higher than bottom and screen is not expanded completely to the right.
Is there any launch image or any other setting i need to add to make screen size fit for all devices.
I have the following settings in my xcode.
firstly, you have to check that you had enabled Size Classes
Secondly, you need to set the constraints at the storyboard accordingly
*
Unchecking "Use Size Classes" option and then coming back and re-checking it again fixes this issue.
1. In the project navigator, select a storyboard or xib file.
2. The file’s contents open in Interface Builder.
3. Choose View > Utilities > Show File Inspector.
4. In the Interface Builder Document section, un-tick the "Use Size Classes" checkbox.
5. Leave the menu. Come back and tick the "Use Size Classes" checkbox again.
*
I'm trying to get it to be an iphone project, but when I drag any view controller into the storyboard, it's just a weird almost-square, neither ipad nor iphone. What am I doing wrong here? Newest version of XCode.
This is a new feature called "size classes". You can use it to create a universal storyboard for iPhone and iPad at once.
But I don`t really like it so here is how to turn off: In storyboard, open utility inspector (right), then go to file inspector (left) and now disable "Use Size Classes". Then you will get the standard storyboard.
You're not doing anything wrong. The default is to design with UI constraints so that the actual output size doesn't matter.
What you can do is set the size you want to preview your controller at in the options in the right hand pane. E.g.