-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorporating top layout guide #9
Comments
I managed to do what I want using |
At the moment topLayoutGuide and bottomLayoutGuide are not supported directly. However you could try using the length property of topLayoutGuide: [self.emailTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.view.mas_top).with.offset(self.topLayoutGuide.length + 20);
}]; if self.view is self.emailTextField's superview, then you could also write this as [self.emailTextField mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(@(self.topLayoutGuide.length + 20));
}]; Let me know if that works for you |
Yes, that kinda works, but I ended up by implementing my own version of those layout guides (for the sake of iOS 6 compatibility). The problem with |
The problem with the |
Oh excellent, thanks and sorry for the noise! |
topLayoutGuide deprecated in iOS 11, Use view.safeAreaLayoutGuide.topAnchor instead of topLayoutGuide.bottomAnchor_
|
I am using a transparent
UINavigationBar
andUITextField
. I want it to be 20px under the navigation bar, so I'm using the following commands:However, my text field appears beneath the navigation bar, 20px from the top of the screen.
-- iOS 7 SPOILER ALERT --
In iOS 7 there is a
topLayoutGuide
property onUIViewController
. How can I incorporate it using Masonry, so my text field appears under the navigation bar (84px from the top of the screen) both in iOS 7 with transparent navigation bar and in iOS 6?I know that it can be done using
NSLayoutConstraints
. Taken from the documentation:The text was updated successfully, but these errors were encountered: