2013-04-07 76 views
1

所以我有兩個觀點,我試圖用導航連接。線程1:SIGBART信號

我已經在導航控制器嵌入他們並在故事板創建它們之間的推賽格瑞:

enter image description here

它第一控制器我一起添加一個按鈕來導航用的方法的viewDidLoad中

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view, typically from a nib. 

    UIBarButtonItem *myButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(buttonClicked:)]; 
    self.navigationItem.rightBarButtonItem = myButton; 
} 

- (void)buttonClicked 
{ 
    NSLog(@"hello"); 
} 

它編譯罰款,我可以在模擬器中運行它,但是當我點擊的記錄,而不是「你好」在導航欄上的按鈕,我得到:點擊時應該調用

enter image description here

任何想法如何解決它?我已經用完了想法。我正在使用最新的XCode。

+1

如果sigaborts,那麼就極有可能的NSException拋出。顯示異常消息。另外,這與Xcode無關。 – 2013-04-07 12:03:45

+1

嘗試通過轉到斷點來設置異常斷點 - >單擊左下角的小加號並添加「異常斷點」並再次運行應用程序 – btype 2013-04-07 12:19:56

+0

如果btype正確,則會創建一些控制檯輸出。你看了控制檯嗎? – 11684 2013-04-07 12:24:05

回答

6

嘗試刪除:在你的目標行動:

UIBarButtonItem *myButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(buttonClicked)]; 

,如果你想使用冒號定義你的方法是這樣的:

- (void)buttonClicked:(id)sender 
{ 
    NSLog(@"hello"); 
} 
+2

哇,很好的接收! – 11684 2013-04-07 12:22:36

+0

感謝這工作完美:) – 2013-04-07 17:00:05