2011-11-18 60 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委托访问它。如果是这样,那么尝试保留该阵列或分配它。