Storyboard Safe Area wrong/fixed width for any device - ios

After some rearrangement of the views in a view controller in storyboard, the safe area in that specific view controller became bugged. For any device I select the safe area never update its frame width.
In the gif below, I have the Safe Area selected in the document outline to illustrate that.
When run in a device, the safe area works as expected. So this is an Interface Builder specific problem. Doing a Cmd+Shift+K Clean and deleting Derived Data is not working.
So, is there a known method to rescue that view controller other than recreate it in a new one?

I recently had the same issue.
The way I resolved the issue was I selected the "Safe Area" in the storyBoard navigator.
After that I used the restraint controls and choose reset to suggested constraints.

This bug happens if a UIStackView contains at least one multi-line UILabel without an explicit preferred width. I have found no easy workaround that succeeds in all cases.

Here's a tip how to debug these issues: Turn off the "Installed" checkbox on individual views in your scene until the problem goes away. By process of elimination you can identify which control or constraint is causing problems.

Related

When I drag any objects into autolayout in xcode, it automatically goes fullscreen and I can't resize it

Is there a setting I accidentally checked that would force this behavior? Even button objects occupy the entire screen.
I figured it out. I accidentally deleted the view object from the view controller. The view objects acts as a container for other objects and "handles the rendering of any content in its area and also handles any interactions with that content." You just drag and add the view object back in autolayout and everything works again.
It's weird behaviour. Maybe fixed in new avaialble xCode. Anyways, after dragging an object, click on the object and goto Size Inspector and change the width and height along with X,Y if required. The size will be reduced and you can make use of it.
For each object you have to reset the layout rules. Or disable the autolayout from your storyboard (look at the image)

Xcode 6 switches being truncated on left (in a table view)

For some reason I cannot get all switches to display properly on a screen. Some of them appear to be overwritten on the left edge but from what I can determine all of the switches and text views are correct. Any suggestions are welcome
So first, to make sure that this is the problem: while your app is running, click on the two rectangles overlapping on the right of the Debug Area to "Debug View Hierarchy"
When you have that, rotate your views to make sure that in every row you don't have your text views overlapping your switches. That's what it looks like what's happening, but you can use this tool to confirm so.
If so, and you are using auto layout, make sure you are setting your constraints correctly. If not, then make sure you are setting the width properly. To prove it's an autolayout issue, you could temporarily hard code a length to every text view to see if the issue is still there. If that fixes it, than auto-layout is just making your textviews wider than they should be.
Good luck!

Missplaced views every time i open the storyboard

I'm using a storyboard with some ViewControllers that have elements positioned with autolayout. Every time i open the storyboard, i get misplaced views even after i fix all of them. I have to update the frames time and time again. Is there any way to fix this?
I'm using xcode 6.
As #Anil Varghese pointed out the problem is the size of the view. Anything other than wAny hAny will trigger this warning when opening the storyboard file. I think it's an Xcode bug.
So I had to make sure that my views are set up like in the picture above. This means designing for all sizes, so, in my case, my UI got all messed up and i had to redesign it. But it was for the best!
When you change to wAny hAny you view elements will become invisible because they are bound to other size classes (like wCompact hAny). You need to delete those rules from the Attributes inspector.
I got the same issue, and I also did not know how to fix it completely, but I found this way to make it show what I want.
"Reset to suggested constraints"
then, I set the storyboard back to "w Compact h Regular".
hope it could help you.

Storyboard View Elements Greyed Out

I'm currently trying to edit a storyboard file, in Xcode 6 (not sure if this is an Xcode bug, or if i've just done something), and when I go to the view i want to edit this is what the scene shows me :
Is this something I've enabled accidentally? or if it's an Xcode problem. It first did this after I enabled source control for the project.
Anyone have an idea on how to fix?
The problem is probably related to Size Classes. If you have the option enabled make sure that the views were created for the size class that you have currently selected in IB (the grid thing).
If you want to make sure it works with any width and height, find the constraint:
and remove it by clicking on the x, leaving only installed checked:
I think Xcode will stop adding these automatically if you set the view to Any Width | Any Height in the Storyboard:
Check that Installed is checked at the bottom of the Attributes Inspector

iOS 7: Misplaced View Frame for "Label - Label" will be different at run time

I just finished an app on iOS 6 and bought a developer account a week ago so haven't had much time playing with the iOS 7 SDK. Just downloaded the Golden Master version and trying to upgrade my app to be compatible with iOS 7.
I received a lot of warnings saying
Misplaced View Frame for "Label - Label" will be different at run time.
and I am unable to run the program. The project contains tableview and its is parsing and displaying XML feed from an RSS.
How to fix this issue?
The accepted answer will fix the problem, but that's not a good solution because it'll remove all your constraints. If you have spent hours on the constraints then don't do that.
If you click the triangle next to the warning you can get the explanation of what is misplaced. Then you can just move the frame to where it's supposed to be. For example:
In this case I just moved my Text View's y position to 94 and the warning will go away. This is because one of my constraints will force the view to be somewhere else when the app is running, but the position is different than where it currently is in the storyboard.
Another way to move the frame to the right position is to click on the warning next to the View Controller name in your storyboard, and then click on the yellow warning sign, and click update frame.
These two methods are not destructive and will not remove your constraints. If anything it'll show that you may need to do minor readjustments in your constraints.
I had the same issue and I get below response form Apple:
You need to update the constraints to match the frames of these views.
I did the following:
Editor -> Resolve Auto-Layout Issues -> Clear all constraints in ** view controller
then I reordered my objects again in the view.
PS: Try Enrico's solution first.
I had the same issue what you need to is , update the constraints or update the frame.
On storyboard you have a small tool bar as shown in below image.
Please see the meaning:-
You can either choose "Update Frames" or "Update Constraints" and Use "Reset to Suggested Constraints".
This will resolve the issue regarding misplaced View.
Don’t drag and drop views to make adjustments to layout. Edit the applicable constraints instead.
Please , let me know if you not clear.
If you are having troubles finding the Update Frames in xCode it can be done like so:
None of the answers work in all cases. As of recent version of Xcode, using a UISearchBar, enabling scoping field enabled in IB makes the search field appear double height (but doesn't show a the scoping bar beneath it). Whether or not you add a height constraint (of any height) to the search field, you'll get the warning that it is a misplaced view that will be 88 H at runtime but is 44 H in IB. Updating the frames (any or all frames) doesn't resolve it. Seems like a bug in IB.

Resources