gpt4 book ai didi

iphone - 将后退按钮放在由另一个模态视图插入的模态视图内

转载 作者:行者123 更新时间:2023-12-03 20:47:09 25 4
gpt4 key购买 nike

检查一下,我正在将一个模态视图插入另一个模态视图内。但是,我试图在此模态视图中放置一个按钮,但没有运气。

我做错了什么?

谢谢!

 CadastroViewController *addController = [[CadastroViewController alloc] initWithNibName:@"CadastroViewController" bundle:nil];

// This is where you wrap the view up nicely in a navigation controller
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:addController];

// You can even set the style of stuff before you show it
navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;

navigationController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"OK" style:UIBarButtonItemStyleBordered target:self action:@selector(buy)];


// And now you want to present the view in a modal fashion all nice and animated
[self presentModalViewController:navigationController animated:YES];

// make sure you release your stuff
[navigationController release];
[addController release];

最佳答案

您必须将新的 UINavigationItem 添加到实际 View Controller 的导航栏 - 而不是导航 Controller 。

addController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"OK" style:UIBarButtonItemStyleBordered target:self action:@selector(buy)];

关于iphone - 将后退按钮放在由另一个模态视图插入的模态视图内,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4795449/

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