gpt4 book ai didi

ios - UINavigationBar 调整大小并覆盖 UIViews

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:22:59 26 4
gpt4 key购买 nike

我们从 Storyboard中实例化一个 UINavigationController 和一个 UIViewController,如下所示:

UIStoryboard *sb = [UIStoryboard storyboardWithName:@"AddOrder" bundle:nil];
UIViewController *vc = [sb instantiateInitialViewController];
UIViewController *topVC = ((UINavigationController *) vc).topViewController;

vc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentViewController:vc animated:YES completion:NULL];

enter image description here

从这里看,UIViewController 似乎没有占据整个 UIWindow,它看起来像在 ios6 上向下 20 pts。如果仔细观察,您甚至可以在左上角看到底层 UISplitViewController 的分隔线。

问题是,当用户在 UIViewController 上的 UITableView 上点击一个选项时,我们调用 [self performSegueWithIdentifier: sender:] 这将新的 UIViewController 推上去,但是当他们旋转它时,它看起来像这样:

enter image description here

至少可以说有点局促。 但是现在,当我们回到第一个 UIViewController 并旋转时,我们得到这个:

enter image description here

问题是,搜索栏现在被覆盖了。您会注意到您也无法再看到底层的 UISplitViewController。如您所见,现在 UINavigationBar 似乎覆盖了其他 20 点并且高度更大。

我通过调用 self.edgesForExtendedLayout = UIRectEdgeNone; 来“修复”了这个问题,但这只是将 UIView 推得很低。我还尝试添加 [UIViewController attemptRotationToDeviceOrientation] 但什么也没有。在 Apple 的 HIG 中,它声明导航栏不应更改它在 iPad 上的高度,但当我注销框架时,这发生在我身上。

有什么想法吗?

最佳答案

您好,您可以使用这些属性创建 View Controller enter image description here

并在应用程序窗口中添加模式

[self.view.window.rootViewController presentViewController:vc animated:YES completion:nil];

我想你的问题将由此解决。

关于ios - UINavigationBar 调整大小并覆盖 UIViews,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24070281/

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