开发者

call method from another class generating SIGABRT error on xcode

I am calling a method contained on a controller class that have to change views. It generates an error on insertsubview.view. How to solve it? Thank you

call from current menuViewController class:

- (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 setAnimationDurat开发者_StackOverflow社区ion: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];
}


You cannot insert a nil valued object as a subview. Typically the view controller will make sure it is created when you try to get its view property, using the appropriate method depending on whether it is a view defined by a NIB file or not.

IF you are doing something to explicitly set the view to nil then you are probably not taking the right approach. I suspect you are doing something fishy inside your call to:

  [self.controladorAjustes viewWillAppear:YES];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜