0
我想在單擊按鈕時打開一個標識爲AddSourceViewController
的新視圖。我使用下面的代碼可以這樣做:更改視圖在viewDidLoad中工作,但不在按鈕上單擊IBAction
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"AddSourceViewController"];
[vc setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentModalViewController:vc animated:YES];
當viewDidLoad
上的初始視圖使用此代碼的工作完美,開啓額外的視圖。但是,我在初始視圖中的按鈕上添加了一個IBAction,當我添加上面的代碼以嘗試打開按鈕單擊時的新視圖時,我只獲得Thread 1: breakpoint 5.1 6.1
。我怎樣才能得到這個按鈕操作?
編輯:下面更好的錯誤信息。
2012-11-23 16:33:40.399 Marketr[23454:c07] -[SecondViewController addSourceButton:]: unrecognized selector sent to instance 0x6e2f5c0
2012-11-23 16:33:40.400 Marketr[23454:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SecondViewController addSourceButton:]: unrecognized selector sent to instance 0x6e2f5c0'
那麼,在我的.h中,我看到'@ implementation'是一個合成的東西,還有一個空白的藍色箭頭。也許我看着錯誤的東西? –
如果您看到一個藍色箭頭,那是一個斷點。看看Xcode的頂部,中心。您會看到一個箭頭圖標,單擊該圖標關閉所有斷點。然後再試一次。 –
當'Thread1:signal SIGABRT'失敗時,它總是把我帶到這個'@ autoreleasepool'中。 –