Created
July 5, 2021 08:36
-
-
Save marybnq/bfbee354d1846536ac5f17ae47703b12 to your computer and use it in GitHub Desktop.
A class containing the actual dimensions of the iOS keyboard
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
class Calculator { | |
/** | |
@return height of the view containing the keyboard buttons | |
*/ | |
static func getKeyboardHeight()->CGFloat{ | |
if UIDevice.current.userInterfaceIdiom == .phone { | |
// Portrait Landscape | |
return getWidth() < getHeight() ? 216 : 162 | |
} else{ | |
// Portrait Landscape | |
return getWidth() < getHeight() ? 265 : 353 | |
} | |
} | |
/** | |
@return the height of the toolbar | |
*/ | |
static func getToolbar() -> CGFloat{ | |
if UIDevice.current.userInterfaceIdiom == .phone { | |
return getWidth() < getHeight() ? 45 : 38 | |
} | |
//iPad | |
return 55 | |
} | |
static func getWidth() -> CGFloat{ | |
return UIScreen.main.bounds.width | |
} | |
static func getHeight() -> CGFloat{ | |
return UIScreen.main.bounds.height | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment