gpt4 book ai didi

ios - 推送 UINavigationController

转载 作者:行者123 更新时间:2023-11-28 17:54:34 28 4
gpt4 key购买 nike

我在推送 View Controller 时遇到问题。这就是我所做的:单击一个按钮,我使用这段代码添加了一个模态视图,我工作正常:

- (void)addAction:(id)sender
{
uipickerForContract *addViewController = [[uipickerForContract alloc] initWithNibName:@"uipickerForContract" bundle:nil];
addViewController.delegate = self;

addViewController.modalPresentationStyle = UIModalPresentationFormSheet;
addViewController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

[self presentModalViewController:addViewController animated:YES];

addViewController.view.superview.frame = CGRectMake(50, 740, 695, 245);


}

这个添加的 viewcontroller 包含一个完成按钮,我想使用它来导航到其他 viewcontroller:所以我使用该代码但它没有用,它只是关闭了 addeview:

 donebutton{

nextview*s = [[nextview alloc]initWithNibName:@"nextview" bundle:nil];
s.view.frame = CGRectMake(10, 20, 745, 755);
//nextview contains the object that I want to pass :object
s.object= self;
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:self];
[self dismissModalViewControllerAnimated:YES];
[self.navigationController pushViewController:s animated:YES];
NSLog(@"self.nav%@",self.navigationController);
}

最佳答案

View Controller 的 self.navigationController(您以模态方式呈现)将为零

而且你无法注意到这个东西,因为你正在分配导航 Controller 对象。

关于ios - 推送 UINavigationController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16772503/

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