当我想从 viewcontroller 切换到 Register.xib 时,我得到一个错误并最终进入 main.m。当我在我的 Register.h 中没有任何变量时它起作用了,但是一旦我添加了一个变量它就不起作用了。
-(IBAction)Register:(UIButton *)sender
{
//[[NSBundle mainBundle] loadNibNamed:@"Register" owner:self options:nil];
if(!reg)
{
reg = [[Register alloc]initWithNibName:@"Register" bundle:nil];
}
UIBarButtonItem *backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = backBarButtonItem;
[self.navigationController pushViewController:reg animated:YES];
}
当我按下注册按钮时,我在这里结束:
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}