gpt4 book ai didi

objective-c - ios导航错误使用按钮

转载 作者:行者123 更新时间:2023-12-01 19:20:49 24 4
gpt4 key购买 nike

我正在尝试从登录屏幕转到注册。但是出现错误...

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target .'



登录.H
#import "SignupController.h"

@interface LoginController : UIViewController {

IBOutlet SignupController *signupController;

登录.M
(IBAction)signup:(UIButton*) sender
{
NSLog(@"lla");
[self presentModalViewController:signupController animated:YES];

}

最佳答案

您需要先分配并启动您的注册 Controller 。

self.signupController = [[SignupController alloc]initWithNibName:xibname];
[self presentModalViewController:signupController animated:YES];

其中 xibname is 将是您的 nibfile 的名称,类似于 @"signupController"
如果你的接口(interface)文件被称为 signupController.xib
塞巴斯蒂安

关于objective-c - ios导航错误使用按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10436260/

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