iOS: pick width & height as default constant in portrait orientation
This commit is contained in:
parent
26103255a0
commit
3d656e13c6
@ -62,13 +62,25 @@ - (instancetype)init {
|
|||||||
if (TARGET_OS_SIMULATOR == 1) {
|
if (TARGET_OS_SIMULATOR == 1) {
|
||||||
platform = [NSProcessInfo new].environment[@"SIMULATOR_MODEL_IDENTIFIER"];
|
platform = [NSProcessInfo new].environment[@"SIMULATOR_MODEL_IDENTIFIER"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
|
||||||
|
CGFloat screenWidth;
|
||||||
|
CGFloat screenHeight;
|
||||||
|
if (orientation == UIInterfaceOrientationPortrait || orientation == UIInterfaceOrientationPortraitUpsideDown) {
|
||||||
|
screenWidth = [[UIScreen mainScreen] bounds].size.width;
|
||||||
|
screenHeight = [[UIScreen mainScreen] bounds].size.height;
|
||||||
|
} else {
|
||||||
|
screenWidth = [[UIScreen mainScreen] bounds].size.height;
|
||||||
|
screenHeight = [[UIScreen mainScreen] bounds].size.width;
|
||||||
|
}
|
||||||
|
|
||||||
_innerEnvironmentDictionary = @{
|
_innerEnvironmentDictionary = @{
|
||||||
@"platform": @"iOS",
|
@"platform": @"iOS",
|
||||||
@"platformVersion": [[UIDevice currentDevice] systemVersion],
|
@"platformVersion": [[UIDevice currentDevice] systemVersion],
|
||||||
@"appName": infoDictionary[@"CFBundleName"],
|
@"appName": infoDictionary[@"CFBundleName"],
|
||||||
@"appVersion": infoDictionary[@"CFBundleShortVersionString"],
|
@"appVersion": infoDictionary[@"CFBundleShortVersionString"],
|
||||||
@"screenWidth": @([[UIScreen mainScreen] bounds].size.width),
|
@"screenWidth": @(screenWidth),
|
||||||
@"screenHeight": @([[UIScreen mainScreen] bounds].size.height),
|
@"screenHeight": @(screenHeight),
|
||||||
@"screenScale": @([[UIScreen mainScreen] scale]),
|
@"screenScale": @([[UIScreen mainScreen] scale]),
|
||||||
@"statusBarHeight": @([[UIApplication sharedApplication] statusBarFrame].size.height),
|
@"statusBarHeight": @([[UIApplication sharedApplication] statusBarFrame].size.height),
|
||||||
@"hasNotch": @(hasNotch()),
|
@"hasNotch": @(hasNotch()),
|
||||||
|
Reference in New Issue
Block a user