Created
August 5, 2017 05:53
-
-
Save iAmrSalman/a727a18b1e420153fd67a6402e44aa75 to your computer and use it in GitHub Desktop.
[language direction] how can determine the current direction for each individual view
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if #available(iOS 9.0, *) { | |
if UIView.userInterfaceLayoutDirection( | |
for: myView.semanticContentAttribute) == .rightToLeft { | |
// The view is shown in right-to-left mode right now. | |
} | |
} else { | |
// Use the previous technique | |
if UIApplication.shared.userInterfaceLayoutDirection == .rightToLeft { | |
// The app is in right-to-left mode | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment