我尝试了很多方法来显示导航栏,但它对我不起作用。所以我在SecondViewController中放置了Back按钮,它在iPhone上完美适用于我,但终止iPad上的应用程序。
- (IBAction)back:(id)sender {
[self.view endEditing:YES];
if ([[UIDevice currentDevice]userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
LuanchViewController* SVC = [[LuanchViewController alloc] initWithNibName:@"LuanchViewController_iPhone" bundle:nil];
[self presentViewController:SVC animated:YES completion:nil];
}
if ([[UIDevice currentDevice]userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
[self.view endEditing:YES];
LuanchViewController* SVC = [[LuanchViewController alloc] initWithNibName:@"LuanchViewController_iPhone" bundle:nil];
[self presentViewController:SVC animated:YES completion:nil];
}
[self dismissModalViewControllerAnimated:YES];
}
错误: -
2013-10-16 18:44:42.775 iOS-test-harness[7095:c07] -[ViewController back:]: unrecognized selector sent to instance 0xa2accb0
2013-10-16 18:44:50.193 iOS-test-harness[7095:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController back:]: unrecognized selector sent to instance 0xa2accb0'
*** First throw call stack:
(0x2c18012 0x1e8ce7e 0x2ca34bd 0x2c07bbc 0x2c0794e 0x1ea0705 0xdd42c0 0xdd4258 0xe95021 0xe9557f 0xe946e8 0xe03cef 0xe03f02 0xde1d4a 0xdd3698 0x2e51df9 0x2e51ad0 0x2b8dbf5 0x2b8d962 0x2bbebb6 0x2bbdf44 0x2bbde1b 0x2e507e3 0x2e50668 0xdd0ffc 0x240d 0x2335)
libc++abi.dylib: terminate called throwing an exception
答案 0 :(得分:1)
似乎你有一个Class ViewController(主要是LuanchViewController的超类),它调用的是一个不在实现中的方法。
答案 1 :(得分:0)
这看起来像unwind segue动作方法。如果您使用的是故事板,并且iPhone和iPad有一个不同的故事板(这是默认设置),您可能需要确保iPad故事板在每个场景中都设置了正确的视图控制器类。