gpt4 book ai didi

iphone - UIViewController 类中的 presentModalViewController

转载 作者:行者123 更新时间:2023-12-01 18:03:20 26 4
gpt4 key购买 nike

View *view1 = [[View alloc] init];  
[self presentModalViewController:view1 animated:YES];

上面的代码在连接到 UIButton 时有效。 .通过将应用程序放入 viewDidLoad: 启动应用程序后,它不起作用。方法。我想在启动时运行它。

最佳答案

仔细查看您正在调用的方法:presentModalViewController:提出 Controller ,而不是 View 。

正确的模式是这样的:

MyViewController* myViewController = [[MyViewController alloc] initWithNibName:@"MyView" bundle:nil];
[self presentModalViewController:myViewController animated:YES];
[myViewController release];

关于iphone - UIViewController 类中的 presentModalViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3739944/

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