0
我正在調用一個包含在控制器類中的方法,該方法必須更改視圖。它在insertsubview.view上產生一個錯誤。如何解決它?感謝您從當前menuViewController類來自另一個類的調用方法在xcode上產生SIGABRT錯誤
電話:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
aboutTabController * myObject = [[aboutTabController alloc] init];
if (indexPath.section == 1) {
switch (indexPath.row) {
case 0:
[myObject turnIdioma];
break;
case 1:
//
break;
default:
break;}
}
}
//method implememented in controller class:
- (void) turnIdioma
{
[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationCurve: UIViewAnimationCurveEaseInOut];
if (self.controladorAjustes == nil)
{
settingsViewController *aController = [[settingsViewController alloc] initWithNibName:@"mailViewController" bundle:nil];
self.controladorAjustes = aController;
[aController release];
}
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:self.view cache:YES];
[self.controladorMenu viewWillDisappear:YES];
[self.controladorAjustes viewWillAppear:YES];
[self.controladorMenu.view removeFromSuperview];
[self.view insertSubview:controladorAjustes.view atIndex:0];
[self.controladorMenu viewDidDisappear:YES];
[self.controladorAjustes viewDidAppear:YES];
[UIView commitAnimations];
}
在將它作爲子視圖插入之前,請檢查controladorAjusted.view的值。它可能是零嗎? –
是的,它是零。方法執行時,必須移除調用該方法的類的視圖,這是否會成爲問題? – Ruth85
好的,解決了,只是在調用xib的時候!名字不正確。謝謝。 – Ruth85