2011-11-18 64 views
0

我正在製作應用程序,其中當我加載應用程序並更改方向時,它可以處理方向。但是,如果我點擊任何TableViewCell在RootViewController的顯示在DetailViewController表的splitViewBased應用程序,然後用SIGABRT改變方向,然後我的應用程序崩潰,並給出以下信息:我正在寫iPad方向更改返回SIGABRT信號

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[_UITableViewReorderingSupport count]: unrecognized selector sent to instance 0x4e4eb30' 

的方法手柄的方向是:

// Ensure that the view controller supports rotation and that the split view can therefore show in both portrait and landscape. 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
    //hot fix sometimes in multilevel bar button is shown in landscape mode. 

    if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight) { 
     [[self navigationItem] setLeftBarButtonItem:nil]; 
    } 
    else { 
     [[self navigationItem] setLeftBarButtonItem:self.appDelegate.rootPopoverButtonItem]; 
    } 
    return YES; 
} 
+0

你需要包含更多的代碼。有很多不同的方式可以像這樣崩潰iOS應用程序。你幾乎可以確定在產生這個錯誤的一個視圖中的'didRotateTo ...'或'didRotateFrom ...'方法中有代碼。 – MusiGenesis

+0

我已經放置了我在我的應用程序中處理旋轉的代碼 – user1048396

+0

您正在將消息'count'發送到'_UIUableViewReorderingSupport'。那是什麼?你想要計算什麼? –

回答

0

添加的NSLog後,如果和其他人,以確保它的閱讀每一個,看看哪裏飛機墜毀。如果有didRotateTo或didRotateFrom,那麼也可以添加NSLog以查看發生了什麼。

也試試只是返回YES:在shouldAutorotate和nix的if/else,以確保它確實正確地旋轉,沒有別的事情正在進行。

最後,檢查你的目標>支持設備方向,以確保所有的方位都支持

2

你將最可能使用數組的內容裝載到表,並在重裝或填充表的點在內容中,數組數可能爲0或數組實例將失去其作用域,並且您將嘗試直接從cellForRowAtIndexPath委託訪問它。如果是這樣,那麼嘗試保留該陣列或分配它。