gpt4 book ai didi

ios - 模态视图中的导航 Controller

转载 作者:可可西里 更新时间:2023-11-01 04:09:57 24 4
gpt4 key购买 nike

目前,当点击一个按钮时,会出现一个 UIModalPresentationSheet。当它向上滑动时,我想在它的顶部添加一个导航栏。我尝试了很多东西,但似乎没有任何效果。这是我目前正在尝试的,它返回了这个错误。

    AthleteAdd *addAthlete = [self.storyboard instantiateViewControllerWithIdentifier:@"addAthlete"];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:addAthlete];
//[self.navigationController pushViewController:addAthlete animated:YES];

addAthlete.delegate = self;
addAthlete.modalPresentationStyle = UIModalPresentationFormSheet;
// UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:addAthlete];
[self presentViewController:navigationController animated:YES completion:nil];

但它以模态方式将其向上推,并且没有模态演示表形式。我怎样才能使导航 Controller 的大小正确?

最佳答案

尝试像这样更改您的代码:

    AthleteAdd *addAthlete = [self.storyboard instantiateViewControllerWithIdentifier:@"addAthlete"];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:addAthlete];

addAthlete.delegate = self;
navigationController.modalPresentationStyle = UIModalPresentationFormSheet;


[self presentViewController:navigationController animated:YES completion:nil];

因为在这里,您尝试从自身呈现 addAthlete。所以你得到这个错误。

关于ios - 模态视图中的导航 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19182955/

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