gpt4 book ai didi

ios - 设备位置与模拟器位置

转载 作者:行者123 更新时间:2023-12-01 18:55:31 25 4
gpt4 key购买 nike

我已经为侧栏编写了代码。它在模拟器上正确显示,但在实际设备上显示不正确。我无法弄清楚?我用横向布局定义了我的 Storyboard。设备正在运行 7.0 但模拟器 8.1。

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
[sideBarLeft insertMenuButtonOnView:[UIApplication sharedApplication].delegate.window atPosition:CGPointMake(self.view.frame.size.width-980,0) atSite:@"Left"];

}

模拟器:

enter image description here
设备

enter image description here

最佳答案

在早期版本的 iOS(7 及以下)中,UIWindow坐标系不旋转。
尝试将 subview 添加到窗口时,通常的做法是根据当前设备方向应用变换。 (类似于此处接受的答案:iPhone - UIWindow rotating depending on current orientation?)

对于 iOS 8 及更高版本,UIWindow 坐标系会旋转,因此不再需要应用此变换。如果您的应用程序仅针对 iOS 8+,则您不必更改代码,如果您的目标是更早的版本,则需要进行类似于我上面链接的答案的处理。

关于ios - 设备位置与模拟器位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27533681/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com