In the first Landscape image, I put view rectangle and fill the background color. Then, I put the text. But when I rotate the device, the rectangle overlaps to the blue image. In the second Portrait image, the text label is not the center of the screen. Please could anyone help me to layout any objects easily in iOS? Although I add constraints to objects, it does not work well. I don't understand clearly about the constraint.
Asked
Active
Viewed 80 times
-1
-
You need to connect a constraint between the top of the text label and the bottom of the view above. At the moment it looks like you have set the top of the text label relative to the top of the superview. You also need to set a constraint to ensure that the text label reaches to the edge of the superview. You could do this by making the width of the text label equal to the upper view or connecting the text label's leading edge to that of the superview. – sketchyTech Mar 11 '16 at 10:07
2 Answers
0
Remember to set constraint for leading
and trailing
space to superview for the rectangle view.
Same do your label, and set text-alignment to center in attribute inspector.

Lee
- 850
- 11
- 23
-
I cannot find that constraint. By the way, I'm a beginner level in iOS. Could you please tell me in detail? Should I select the rectangle or storyboard? – May Phyu Mar 11 '16 at 10:19
0
You can see link below to understand more about autoLayouts
https://developer.xamarin.com/guides/ios/user_interface/designer/designer_auto_layout/

ios
- 955
- 1
- 12
- 35