xCode7 StackViews inside ScrollView overlapping views - ios

this is my first job with xCode and I'm migrating an Android App to IOs. I'm attempting to create a ScrollView with some items inside of its content view. Below is a print of the Storyboard tree:
When I run the app, the items below the selected StackView, including it, do not appear correcly on the simulator. They are all overlapped at the top of the screen:
I have already double checked all the constraints, along with other properties on the views but could not find the issue. Any help will be very appreciated.
Thanks!
=========================================
Thanks, Imran. This helped me find the issue. But I still would like to understand it. As you can see from the picture below, some of the views in my storyboard have this "wAny hR" property set. Literally all the stackviews and, the Labels and Buttons which were messy. Once I remove this property and set the "Installed" one, they showed up ok. Any thoughts on that?

Related

Constraints Problems with table view cell

I have problems with constraints in table view cell. As you can see in the image above , I tried to constrain the label on the far right so that label will be closer to the right right edge. But that isn't reflecting on the ipad in preview. Whats wrong? and How do solve this problem ? Thanks for any help !
The prototype cell in the storyboard is just that: a prototype. It isn't "real". It will be used as a cell when the app runs, and layout will occur. But the Preview in the storyboard in Xcode (in your version of Xcode) doesn't reflect any of that.
So the only way to see the effect of your constraints is to build and run the app in an appropriate Simulator.

IOS: Storyboard showing UIButton in Different place when selected

Something weird has happened to my storyboard. Some buttons and labels are not showing where they should based on their coordinates and also how they appear when the app runs.
In the following picture, when selected the outlines of the elements are appearing above where they do in the actual storyboard.
There are no constraints and I'm not using autolayout. The storyboard just seems to have gotten out of whack.
I have tried closing the progam and reopening and also cleaning project without success.
Thanks for any suggestions on how to get buttons/labels to appear where they should based on their x,y, width, height settings.

How to set constraints to a tableView into a viewController?

I'm trying to place a tableView in a viewController, but im not able to constraint properly the tableView, i'm doing the usual things, i'm sticking the leading, trailing and bottom constraints to superview, and some space to the top superview. But as shown in the preview, table view does not look to be constrained, the effect that it brings for me is that when i put elements into content view, they extend along the right side i can not see them for small devices. Does anyone know what could be happening?
Thanks in advance!
StoryBoard Tree
After spending long time checking what happened i figured out that there is a Xcode fail on it, i run it in simulators and real devices and it works perfect, the bad thing is that everything i inserted into that view does not look as it should in the preview, but again, in simulator everything works fine. So, preview is not always as trusty as i expected and now i know it

Update constraints menu all greyed out

When I try to update constraints in Xcode 6.3, I can't because the menu is completely or partially greyed out.
http://hostthenpost.com/uploads/aa150beda71316c338da81c5e301d149.png
Why is this? How do I fix it? The app is a basic, simple Hello World app with two UIImageView elements both sharing heights and widths, and one is constrained 50 from the left, the other 50 from the right. What is wrong with it? How to I make it so I can update the constraints?
Edit: This is when I can see some, but not all of the constraints options.
http://hostthenpost.com/uploads/2d8a3bec6a17524d6f9ca1524c95fb0c.png
That happens when you have a wrong item selected, meaning for example a constraint instead of the view or a subview.
To fix it, just select the view again. Then the options should show up again.
Still some options will be grayed out, if they would have no effect when clicked. For example Update Frames will only be available if there are actually are frames to be updated.
If you clicked on the main view and then on the constraints button, you have to know that you can't adding constraints from the main view in the storyboard, to its superview. You can do this just by code.
If you are trying to change the constraints for any other subviews, please be sure to click with the mouse on the object in the view, and then on the constraints button.

Xcode 6 view controller showing blank screen with autolayout

I'm trying to use view controller that I decided to use auto layout for. Before I used auto layout, the view showed normally like how I intended it to during runtime. But I decided to switch to auto layout (because after all, bigger iPhones are coming), and even after setting it up, getting no issues at all, and seeing that the app scaled well to the iPhone size in IB; I still have a blank screen. To prove it, here are pictures:
So why is this happening? I added the constraints in the square view, and it gracefully scaled to the iPhone view in Interface Builder. If you also look at the sidebar, the alerts for auto layout errors are not present. And IB is rendering everything. But why is the simulator blank?
And yes, I connected all the elements to be code correctly. I verified. And yes, I have code that puts text in a label. Here it is, in the 'viewDidLoad()' method:
override func viewDidLoad() {
super.viewDidLoad()
self.titleLabel.text = "Hello, World!"
}
And I will reemphasise: the app worked before I did auto layout. For this build, I deleted all the elements, relocated them, reconnected them, and added tweaked the view with auto layout unit IB rendered it correctly. But I'm getting different results here.
Please help me. Oh, and sorry for the massive images, I can't figure out how to shrink them.
EDIT: I've gone through and used the view debugger, and tried to capture the view hierarchy to look for clipping or occlusion. Funny enough, the view debugger shows the content properly, and there wasn't any clipping or occlusion that I saw. When I tried to show frames in the simulator though, it didn't show anything. I'm starting to think that this is a simulator bug. Currently, I'm using Xcode 6 beta 6.
I recreated the issue by adding a collection view to a standard view controller and this seems to be the problem:
Having Xcode add suggested constraints gives you this, which causes the view to not show up.
It is aligning the view's left and right to the layout guides (which doesn't seem to be right)
You will have to manually add spacing constraints to your view.
This is what you want:
Try turning on the assistant editor and use Preview while tweaking your constraints.
(source: mattknott.com)
Do your Editing in "wAny hAny For All Layouts Base values" mode. then you will not see blank screen while testing on different devices.
Mode selection can be one from bottom bar.
Good Luck

Resources