I am trying to align the top of the white subview to half the height of the container view in the viewcontroller. See attached image. In old versions of Xcode it was possible to CTRL-drag from the view to the container view and select "top alignment with the container view", but in the new Xcode 6.1 they offer only alignment with the "TopLayout guide". So I used that constraint and setup the constraint as you can see in the right hand side of the image. Based on my reading, the following equation applies:
property1 = property2 * multiplier + constant.
So I wanted to do this with my settings: View.top = TopLayoutGuide.bottom * 0.5 + 0
such that the top of the white "View" aligns with half the height of the TopLayoutGuide.bottom. However, when I do this, the result is that the ).5 is totally ignored, and the white view's top is aligned with the TopLayouGuide.bottom, covering the whole screen basically.
Can someone figure out what I am doing wrong, and what is the proper way to align the View's top to half the height of the container?
thanks
-Malena
You can't achieve what you want to do in Interface Builder. But this is possible by creating constraints via code. I have created a sample project for you which you can download from Here
Below is the code of ViewController file to add constraints via code. Note: I have added arbitrary constraints in Interface Builder since we need to get the main view height. Those are also important
Hope this helps you :)