Skip to content
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

Add iPhoneX layout support #372

Merged
merged 1 commit into from
Mar 29, 2018
Merged

Conversation

javaboyjunior
Copy link

Move topview down to the safe area guides and increase bottomview height by the safe area height.

Move topview down to the safe area guides and increase bottomview height by the safe area height.
@javaboyjunior javaboyjunior mentioned this pull request Jan 8, 2018
attribute: .notAnAttribute,
multiplier: 1,
constant: BottomContainerView.Dimensions.height))
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I was also about to add the iPhoneX support, but I'm glad that you were quicker ;-)

LGTM 👍

Just as an idea: You could add the new constraints in a bit more compact way like this:

    var topViewToItem: Any? = view
    var bottomContainerHeight = BottomContainerView.Dimensions.height
    
    if #available(iOS 11.0, *) {
        topViewToItem = view.safeAreaLayoutGuide
        bottomContainerHeight += UIApplication.shared.keyWindow!.safeAreaInsets.bottom
    }
    
    view.addConstraint(NSLayoutConstraint(item: topView, attribute: .top,
                                          relatedBy: .equal, toItem: topViewToItem,
                                          attribute: .top,
                                          multiplier: 1, constant: 0))
    
    view.addConstraint(NSLayoutConstraint(item: bottomContainer, attribute: .height,
                                            relatedBy: .equal, toItem: nil,
                                            attribute: .notAnAttribute,
                                            multiplier: 1,
                                            constant: bottomContainerHeight)
    )

@javaboyjunior
Copy link
Author

javaboyjunior commented Jan 12, 2018 via email

@pixeldock
Copy link

I'd go for the more compact version, but your version is also fine. You decide ;-)

@javaboyjunior
Copy link
Author

Let's go with mine just because I have it committed, testing and working in my fork - will save me backing it out and reapplying. Thanks for taking the time to provide feedback!

@valeriyvan
Copy link

Any reason why this PR is not merged?

@annjawn
Copy link

annjawn commented Mar 28, 2018

@zenangst this PR needs to be merged please. The iPhone X layout issue is definitely going to cause App Store rejection.

@onmyway133 onmyway133 merged commit 71aa8d1 into hyperoslo:master Mar 29, 2018
@onmyway133
Copy link
Contributor

@valeriyvan @annjawn Sorry for late response. Thanks for the PR 🚀

@annjawn
Copy link

annjawn commented Mar 29, 2018

@onmyway133 awesome! 👏🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants