Is there any way to add constraint between a view and the top layout guide in a xib file?

后端 未结 7 2322
时光说笑
时光说笑 2020-12-07 15:44

In iOS 7, we can now add a constraint between a view and the top layout guide, which I think is very useful to solve the status bar offset issue in iOS7(especially when ther

7条回答
  •  感情败类
    2020-12-07 16:10

    From iOS 9 you can also do it more simple with topLayoutGuide's anchors:

    • Swift 3

    view.topAnchor.constraint(equalTo: self.topLayoutGuide.bottomAnchor).isActive = true

    • ObjC

    [controller.view.topAnchor constraintEqualToAnchor:controller.topLayoutGuide.bottomAnchor].active = YES;

提交回复
热议问题