Skip to content
This repository has been archived by the owner on Jun 3, 2021. It is now read-only.

Commit

Permalink
Initialize weex using portrait screen size. (#2898)
Browse files Browse the repository at this point in the history
  • Loading branch information
wqyfavor authored and jianhan-he committed Sep 16, 2019
1 parent b94e830 commit 3939692
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ios/sdk/WeexSDK/Sources/Bridge/WXCoreBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1538,11 +1538,14 @@ + (void)install
env->AddOption("scale", "1");
env->AddOption("pixel_scale", std::to_string([[UIScreen mainScreen] scale]));

// Here we initialize weex device width and height using portrait by default.
CGSize screenSize = [UIScreen mainScreen].bounds.size;
env->SetDeviceWidth(std::to_string(screenSize.width));
env->SetDeviceHeight(std::to_string(screenSize.height));
env->AddOption("screen_width_pixels", std::to_string(screenSize.width));
env->AddOption("screen_height_pixels", std::to_string(screenSize.height));
CGFloat w = MIN(screenSize.width, screenSize.height);
CGFloat h = MAX(screenSize.width, screenSize.height);
env->SetDeviceWidth(std::to_string(w));
env->SetDeviceHeight(std::to_string(h));
env->AddOption("screen_width_pixels", std::to_string(w));
env->AddOption("screen_height_pixels", std::to_string(h));

weex::base::LogImplement::getLog()->setLogImplement(new WeexCore::LogBridgeIOS());

Expand All @@ -1552,8 +1555,6 @@ + (void)install
weex::base::LogImplement::getLog()->setDebugMode(false);
#endif



platformBridge = new WeexCore::PlatformBridge();
platformBridge->set_platform_side(new WeexCore::IOSSide());
platformBridge->set_core_side(new WeexCore::CoreSideInPlatform());
Expand Down

0 comments on commit 3939692

Please sign in to comment.