StackView within StackView - Overlapped Views - ios

I have been trying to put together a view using Stack Views. The layout looks acceptable within Xcode but the 2nd, 3rd and 4th rows seem to overlap a small area when reviewed in the simulator.
There are some autolayout warnings and if I autofix one issue (Fix misplacement > Update frames) others appear. I basically end up toggling between placement issues. I must be fixing them in the wrong way.
Is there anything obviously wrong?
Why are these views overlapping each other?
What strategy should I use to fix the misplacement issues?

Related

Changing layout on rotation with multiple views moving

I'm working on an app where I've got a design with two similar layouts for horizontal/vertical. And it's on an iPad. I've found other answers but I can't use most of them because I've got two tableviews in my view, which means I can't use xibs. I'm also making it for the iPad so changing layout based on height/width variation doesn't work.
The design I'm trying to achieve is in the pictures below. What I'm having troubles with is moving the two views that are stacked on the right in landscape mode to be next to each other and short in vertial. Also I need to move those four buttons and the right-side table to being below the other two views.
I've tried overriding trait functions as described in this blog post but for the life of me can not get it to work.
I'm looking for any advice anyone could give me. I feel like I've hit a wall and can not figure out how I can implement this.
just give the height and width constraints of the subviews with respect to the superview in ratio it'll work.

UIStackView Views are all on one row

I have a problem with Views in a stackview where the different views are all showing on the same line and overlapping. This is in an app that used to be working so i'm not sure if this is a change to the language in some way. Does anyone have any idea why this is the cases and how to fix it?
storyboard
problem result

Stack button fail

Swift 2.2 Xcode 7.3.1. iOS 9. Storyboard. I have 7 rows of four labels across. I was intending to select each row to place it in a stack. Saw this technique in Hagerty's iTunes U (Stanford). Each time I select a row and press the button to add the four across to a stack, it makes these huge rectangles... They have a width of 127,000,000. I keep trying different things, adding all suggested constraints, getting rid of all contstraints, etc.
Any idea what I am doing wrong? TIA
Sorry, I'm apparently not allowed to add images as yet here... The rectangles on the View Controller are all UILabels. When I select a row of them and press the Stack button, next to pin, etc., it appears to make one wide rectangle, all 4 on top of each other, this last time is was 27,216,026 pixels across. I think the comment about not using "suggested" constraints is probably a clue... there certainly seem to be more than necessary. There are also some where I tried to delete a constraint where the constraint item appears to be dimmed. There are one or two where the dimmed one, and an exact copy of the dimmed are both there...
There are no images on the view... the only button is up top, a "Back" button.
Someone gave me the clue. It turns out that there are some bugs in the constraints setup, especially when using "suggested" constraints. I deleted all the constraints, then added just the minimum needed, made sure they were all perfect, and I got one row to work properly. Now I can do the others.
After I do this enough times I am sure it will make sense, there is probably one constraint mechanism that doesn't work as it should - an Xcode bug. One adds size constraints both in the size inspector, and potentially the constraint mechanism, and sometimes they do not match. Those things have to be fuddled with until they do... and then Stacking works...

One item (button) is always smaller in iOS UIStackView

Using Xcode 7.2 [using swift but that shouldn't matter for this] ... I have put two buttons, 'Done' and 'Add', into a UIStackView as such:
But at runtime the 'Add' button is always smaller as:
I have tried every combination of fill and spacing on the StackView, etc. I have tried setting widths and heights but the 'Add' button is always smaller. I have the same problem in another UIStackView (also horizontal) where the Add button is first.
The two buttons shown have the same natural pixel size and are multi-sized. For example here is the setting for 'Add':
I tried deleting it from Xcode and adding it back. Is there some factor that I am missing? This is driving me nuts.
One hint that might help is that I think that when I first added it with this name, it actually was smaller, but since then I have deleted it and re-included it in the project. Perhaps there is some 'memory' there that I can't find?
Ack, thanks so much for the answers and comments. But the problem was that the '#2x' Add image was misscaled. Fixing that fixed the problem; only took me days to find it as I guess I checked and rechecked the 1x and 3x sizes but never the 2x one. Sorry to waste your collective time.
I am still not very comfortable with all the layout settings and have 6 storyboards in the app that have around 60 layout warnings, but am getting there.

Xcode 7 Beta 5 - All subviews missing from Storyboard

I've recently switched up to Xcode 7 Beta 5 and I've been trying to solve the UITableView issue that I know lots have experienced. One solution I found was to disable size classes, however, once I did that I wanted to roll back my solution to a commit I just performed before that.
After I discarded all the changes I was presented with my view controllers and none of their subviews visible in them. In the hierarchy to the left they are listed but are 'greyed out'. Can anyone help with solving this?
Screenshot for reference:
It's worthwhile noting that when the app runs all of the ui elements are still present as expected - just in storyboard they are not displaying.
Try checking it in different layout such as any width compact height.
Grey out generally means that your view are active on a particular layout.
You can see the changes when you tap in the bottom wAny hAny and select different sizes...

Resources