簡體   English   中英

iPad返回上一視圖可終止該應用程序,同時可在iPhone上完美運行

[英]iPad back to previous view terminates the application while works perfectly on iPhone

我嘗試了多種顯示導航欄的方法,但對我來說不起作用。 所以我將Back按鈕放到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

似乎您有一個ViewController類(主要是LuanchViewController的超類),並且它被調用的方法不在實現中。

這看起來像是輕松的segue動作方法。 如果使用情節提要板,而iPhone和iPad使用另一個情節提要板(這是默認設置),則可能需要確保iPad情節提要板在每個場景中都設置了正確的視圖控制器類。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM