wqyfavor commented on issue #2103: Screen orientation problem with iPad version of our app URL: https://github.com/apache/incubator-weex/issues/2103#issuecomment-462038133 最新PR里修复了setViewport 方法,并提供了修改WeexCore计算时使用的屏幕宽度的方法。 https://github.com/apache/incubator-weex/pull/2107 文档待更新,可以先看: ## 6. 在 iPad 中使用 Weex 当页面渲染完成后,屏幕再旋转,页面不会自动适配。所以,如果你的 App 允许屏幕旋转,务必在页面渲染前更新屏幕宽度。 前端样式中指定的坐标在渲染时会根据 **屏幕宽度** 和 **当前页面的 view-port-width** 进行换算。 修改 view-port-width 的方法,会影响前端代码,通常不要设置,默认为 750px。 ```javascript beforeCreate(){ const meta = weex.requireModule('meta'); meta.setViewport({ width: 1536 }); } ``` 监听 UIDeviceOrientationDidChangeNotification 通知,并调用下面方法修改屏幕尺寸(假设已经旋转完成,[UIScreen mainScreen].bounds.size.width 就是当前宽度) ```Objective-C [WXCoreBridge setDeviceSize:[UIScreen mainScreen].bounds.size]; ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
