Created
April 17, 2018 15:35
-
-
Save amirrajan/8b136a83c93f1d46b2b0c4c2b85094ce to your computer and use it in GitHub Desktop.
This file contains 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
module ScreenSizes | |
def iPhone4? | |
UIScreen.mainScreen.bounds.size.height < 568 | |
end | |
def iPhone5? | |
UIScreen.mainScreen.bounds.size.height == 568 | |
end | |
def iPhone6Plus? | |
UIScreen.mainScreen.bounds.size.height == 736 | |
end | |
def iPhone6? | |
UIScreen.mainScreen.bounds.size.height == 667 | |
end | |
def iPad? | |
UIScreen.mainScreen.bounds.size.height == 1024 | |
end | |
def iPhoneX? | |
UIScreen.mainScreen.bounds.size.height == 812 | |
end | |
def device_screen_width | |
UIScreen.mainScreen.bounds.size.width | |
end | |
def device_screen_height | |
UIScreen.mainScreen.bounds.size.height | |
end | |
def screen_rect | |
CGRectMake(0, 0, device_screen_width, device_screen_height) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment