I'm making my UI with IB. My view controller looks like below in IB.
I set the background colour of the view controller to yellow and the subview's to red. Then I set constraints to let the subview's 4 edges align to its superview --- the view controller's view. But what I actually saw was like below.
I printed out the subviews of the view controller's view and found that there was an 'UILayoutGuide'(top, I guess) with a height of 20 px. Is it the reason that the red subview not aligning its top to the superview?
Here are the constraints I added to the red subview.
Other conditions: I'm not setting status bar to hidden. But If I set status bar to hidden([UIApplication sharedApplication].statusBarHidden = YES
), the red subview's layout will become correct(I mean, aligning its 4 edges to the superview's so the yellow background colour can not be seen). Like below.
Any suggestions? Thanks.