gpt4 book ai didi

iphone - 旧显示在模态视图 Controller 后下移问题

转载 作者:行者123 更新时间:2023-12-03 19:02:25 26 4
gpt4 key购买 nike

我检查了其他答案,但没有找到任何真正描述我情况的答案。所以就这样吧。

我有一个基于窗口的应用程序,它从 xib 创建并加载 UIViewController。它禁用了状态栏,高度为 480,UISegmentedControl 的 y 原点为 451。它在屏幕底部显示得很好。*

在 UIViewController 的 viewDidLoad 中,我创建一个 UIView initWithFrame:CGRectMake(0.0, 0.0, 320.0, 431.0)]; (UISegmentedControl 的像素为 480 - 29 像素,状态栏为 20 像素。)我使用 [self.view addSubview:gameBoard]; 将其添加到 UIViewController 中。然后一些 UIView 游戏片段被添加为游戏板 UIView 的 subview ,并且所有内容都按我认为应该的方式显示。

当点击其中一些 UIView subview 时,应该会出现一个菜单。我创建了一个 UIViewController ,上面有所需的控件。我使用委托(delegate)方法从 subview (拾取触发事件)调用到根 UIViewController - 这样做

self.squadOrders = [[SquadOrders alloc] initWithNibName:@"SquadOrders" bundle:nil];
squadOrders.viewControllerDelegate = self;
[self presentModalViewController:squadOrders animated:YES];

模态对话框按照我认为应该的方式显示,从屏幕下边缘向上滑动,没有覆盖状态栏,而是覆盖根 UIViewController 底部提到的 UISegmentedControl。它被驳回

[self dismissModalViewControllerAnimated:YES];

这就是麻烦开始的地方。 UISegmented 控件向下移动 20 像素,因此屏幕底部仅可见 9 像素。 顶部有一个 20 像素的白色间隙, View 已向下移动。

*在此 xib 或任何其他 xib 上启用状态栏根本不会改变所描述的行为。

其他相关的 stackoverflow 问题有:

IPhone - After dismissing Modal View Controller - gap is left at top of page - 但给定的解决方案是没有另一个 View Controller 作为显示模式的 View Controller 的 subview 加载 - 但我没有,只有 UIViews。还有建议在模式消失后重置适当的框架,但这感觉就像作弊。

Contents of UIScrollView shifted after dismissing ModalViewController - 我已经玩过所有 View 和 Controller 的高度 - 我确信它们匹配,但没有帮助。同样,框架可以重置,但它只能解决症状。

还有其他问题,但到目前为止还没有解决这个问题。

最佳答案

我刚刚通过向下移动 View 解决了这个问题。这是因为 navigationBar.barStyle 设置为 UIBarStyleBlackTranslucent

关于iphone - 旧显示在模态视图 Controller 后下移问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2166718/

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