Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

View is tethered to the safe area margin top rather than superview, how would I tether to the superview top?

I don't know why the safe area covered my view on the iPhone X, simulator, but in xCode's view debug it seems ok. Is there any option to hide the safe area view or remove it? thanks in advance! Via the view debug I can see no view or nothing covered my view, it's all right, really strange.

I added this myView in the storyboard which turned on the safe area layout guide. I tried set additionalSafeAreaInsets.top additionalSafeAreaInsets.bottom to zero but it's not working.

Here is how I do the constraints:

func setupGroupBView() {
    self.groupBView = myView.create()
    self.view.addSubview(groupBView) 
    self.groupBView.snp.makeConstraints({ (make) in
        make.width.centerX.centerY.equalTo(self.view)
        make.height.equalTo(screenHeight)
    }) 
}

I tried set the myView's top, bottom to the controller's view.top view.bottom to -44, -34 but still it won't work.

please check this picture that shows the reality!

Please help!!!!

like image 730
Bi Brian Avatar asked Mar 14 '18 13:03

Bi Brian


1 Answers

  1. In your storyboard, select root view.

enter image description here

  1. In the Size inspector panel, uncheck Safe Area Layout Guide

enter image description here

  1. On the Add New Contratint panel, set all margins to 0 and uncheck Constrain to margins Please don't forget to click on Add xx Constraints button in the bottom.

enter image description here

like image 150
Jason Jin Avatar answered Oct 16 '22 22:10

Jason Jin