2
IOS 8對方向變化的碰撞....IOS 8有崩潰的方向變化
首先我們顯示的報告像這裏..
-(void)didShowReport:(NSString *)fileName andFlag:(BOOL) isWeightReport
{
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Document_Picker" bundle:nil];
UINavigationController *nav = [storyBoard instantiateViewControllerWithIdentifier:@"reportNav"];
NSLog(@"topviewcontrolle - %@",[nav topViewController]);
SSReportPreviewViewController *reportPreview = (SSReportPreviewViewController *) [nav topViewController];
reportPreview.fileName = fileName;
//reportPreview.delegate = self;
reportPreview.title = [fileName lastPathComponent];
if(isWeightReport)
reportPreview.mailSubject = NSLocalizedString(@"weightsummaryreport", @"");
else
reportPreview.mailSubject = NSLocalizedString(@"pricesummaryreport", @"");
[nav setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:nav animated:YES completion:nil];
}
在這之後,我們取消該視圖使用
- (IBAction)onCancel:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
取消我們旋轉....碰撞發生後控制器....
ERR或顯示.....如下所示
*** -[UINavigationController _viewControllerForSupportedInterfaceOrientationsWithDismissCheck:]: message sent to deallocated instance 0x16ad08c0
我們調用它在表視圖做選擇索引方法....從那裏我們調用委託方法,以便委託(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell * cell = [self.tableView cellForRowAtIndexPath:indexPath]; NSString * file = [self.delegate didSelectedWithReportType:cell.textLabel.text]; [self.delegate didShowReport:file withTitle:NSLocalizedString(@「MaintenanceReport」,@「」)]; } – 2014-10-08 07:33:07
這是在IOS 7上完美工作,但在IOS 8中只有這個問題......在一個表視圖didselect方法中,我們調用了一個委託[self.delegate didShowReport:file withTitle:NSLocalizedString(@「MaintenanceReport 「,@」「)];裏面這個didshowreport方法這個視圖控制器正在呈現.... – 2014-10-08 07:38:05
謝謝!這解決了我的問題。我正在使用'actionSheet:clickedButtonAtIndex:'將一個'UINavigationController'呈現爲模式,這導致方向更改事件使我的應用崩潰。按照這個答案中的建議,我將它改爲'didDismissWithButtonIndex:'。 – 2014-11-03 08:08:40