I have an issue of storyboard refresh all views, when I change constraints it cannot be change in storyboard but change in simulator and device.
But when I reopen my project then it refresh.I tried below step but nothing happened
Select storyboard->editor-> refresh all views
and also automatically refresh already checked.
Is this bug of Xcode 9.3?
Here I attach image:-
but in simulator look like perfect below image:-
Thanks you.
I have also gone through this strange issue. I believe it creates if your project becomes so much heavy and lot of storyboards used. Therefore using Xib instead of Storyboard is the good option.
If you restart xcode and reopen your project then you can see your view as expected with updated constraint.
I got the answer it's happened due to IBDesignable in my custom library class.If I remove all IBDesignable it's work fine.
Thank you.
I'm using Xcode 9 Version 9.1 (9B55). There is something strange happening in a storyboard. Some of my views are are messed up, and I don't know what is the reason.
It looks like this:
EDITED
However, all my constraints are set right, and when I run the project on different simulators and on a physical device, everything looks fine. Here how it looks on a simulator/physical device:
I don't know what is the reason for this kind of behaviour but it makes impossible to work in a storyboard. I think, this problem has appeared quite recently. Sometimes, after reloading the Xcode, views again look fine, but when I start working with storyboard (adding new views, changing constraints or even just tapping on a constraint to see its constant), they again become messed up. Does anybody have this kind of issue, and how this could be solved?
After closing and opening Storyboard, the issue goes away! I think it's just an issue in x-code 9.
As a quick fix, try changing the spacing on one of your stack views instead of closing and reopening Xcode. Toggling the spacing brings back the views in my case.
I have designed user interface in storyboard in Xcode 7 its working fine when i updated Xcode 8.1 and opened the storyboard the result is below.
I don't know what apple actually doing with this, When ever new update came i struggling on this kind of issue. Can some one guide me how to resolve this?
Thanks
Click on the red button that shows the problems, and see what's wrong, and fix them. Very often you just fix the frames of your views. And then you tap on the various device sizes and check if your layout works with every size.
They did make changes with new xcode 8.0, but I believe its easier then ever.
The concept is same behind only few changes.
Like before you need to do update frames, but now they make it easy so you can view a live preview of your layout without going into preview in show assistant editor.
Just click on device button and it automatically updates frames and shows you your layout.
For more information see: A Beginner’s Guide to Auto Layout with Xcode 8
=== EDIT ========
This issue is now solved in Xcode 8.1. I have checked.
================
I don't know auto-layout properly. So, I am using autoresizing option in my all apps and it's fine for me. I am able to fulfill my all requirements by this without any issue.
Now in Xcode 8, I have migrated my old swift project to swift 3. Now issue arises.
See in image, I have set Autoresizing, and its working fine without issue in all devices until now and this project is live in AppStore, so that I can't show the UI or storyboard.
Now I have to do some update in project. So I am working in Xcode 8 now. But my autoresizing not working properly, as all the controls are come in center and UI is messed up.
And the issue persists in device also. I have checked in simulator and device as well. But problem is there also. Any suggestion and help will be appreciated. Thanks in advance.
EDIT:
Yesterday there is issue in runtime only, But Today storyboard also changed views like this image
Which means the whole UI design is messed up. This is weird.
Facing same issue. As a my point of view this problem is occurred when we use autoresizing and set only inner autoresizingMask to any view controller. Like,
If we use also boundary autoresizingMask at that time not facing this issue. Like,
I don't know this is actual bug of xcode 8 or remove this functionality in xcode 8.
So, Finally my suggestion is that we need to use auto layout in xcode 8.
Please try to uncheck autoresizing from xib or storyboard. And inviewDidLoad set [_scrollView setAutoresizesSubviews:YES];
Try it if this solve your problem
Edit: In case of storyboard uncheck Resize view from NIB option.
I'm not sure about storyboards but I've found a temporary solution for xib files. In Utilities panel (right hand panel) select File Inspector tab. Under Interface Builder Document section, select the file to open in "XCode 7.x". It will ask you to confirm that you do not want to use XCode 8 features, save the file and close it.
Xcode 8 beta 2 solved this problem!! I already checkeded now!
I had a similar issue for scrollView in Xcode8
I have an one solution to work with scrollView
First take a simple UIView and add all component which you want add to in scrollView and give that component to autoSizing
And also take one scrollView and programmatically set view frame and also set scrollView contentSize and add your view into scrollView
like wise, in my case I added this code in viewDidLoad for swift project
// add view to scrollview
self.scrollObjForNextAppointment.contentSize = CGSize(width:self.scrollObjForNextAppointment.frame.size.width,height:410)
self.viewForScrollContent.frame = CGRect(x:0,y:0,width:self.scrollObjForNextAppointment.frame.size.width,height:410)
self.scrollObjForNextAppointment.addSubview(self.viewForScrollContent)
it's work for me, Thanks!
Solved by unchecking "Auto Resize Subviews" to ScrollView
Update the issue seems to have been fixed in Xcode 8.1
Having the same issue and I've found that the offender here is the UIScrollView element. Just move everything outside of your scroller and you will see that everything works just fine, like before.
Which means one possible workaround would be to place your scrollable content in an ordinary UIView, then replacing it with UIScrollView at run time, programmatically.
A moderator kindly deleted my answer here as a duplicate, so see my answer at:
Autoresizing under iOS 10 doesn't work
In response to max, yes, resizing a bunch of subviews can be a pain. That's why I suggested adding a single "content view" to the scroll view and moving all of your existing subviews inside of that view. Autosize the subviews inside of the content view just as you did with the scrollview, and autosize the content view to the scrollview.
It's that content view that you're then resizing inside viewDidLayoutSubviews.
And again, the "content view" inside of the scrollview construct is pretty much the standard way to get auto-sizing scroll views using autolayout, so it should be considered a best practice.
That method is described here...
https://spin.atomicobject.com/2014/03/05/uiscrollview-autolayout-ios/
My method seems a little convoluted, but I was able to patch up a storyboard with about a dozen scenes and Vc's in about 15 minutes. It would have taken much, much, much longer to rebuild everything using auto layout.
Apple just came out with XCode 8.2, which fixes this problem for me. I have been using XCode 7.3.1 for my interface design parallel to 8.1, but I can now use 8.2 without any problems.
The storyboard gets updated with widths and height of frames though, to accommodate the new 'View as:' functionality. Though it doesn't seem to affect running on device/simulator.
Curiously, the bugfix it is not noted in the XCode 8.2 release notes.
Original answer here
I have a very strange issue with Autolayout. Check attacked screenshot, I am primary interested in that red topbar. I set all constraints, and it works pretty well for all sizes, except 3.5in.
How is it possible something like this? Is this an Xcode bug?
Note: There are no constraints added programatically. Everything is right there, in storyboard.
In the end, it proved to be some problems in the way I set constraints. Deleted all, and redoing them, solved the problem.