0

ナビゲーション バーを表示する方法をいろいろ試しましたが、うまくいきません。だから私は secondViewController に戻るボタンを入れました。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
4

2 に答える 2

1

クラス ViewController (ほとんどの場合 LuanchViewController のスーパークラス) があり、実装に含まれていないメソッドをコールバックしているようです。

于 2013-10-16T14:07:23.510 に答える