Search code examples
iphoneobjective-cmultiview

Error in MultiView Window Based app


I'm trying to followng the following tutorial http://www.xcode-tutorials.com/multiview-application/

but I kept running into a

"Could not load NIB in bundle: 'NSBunde...."

It failed in the button click event and the following is the code for the button click event

-(IBAction)swapViews:(id)sender
{
    windowsbasedmultiviewAppDelegate *delegate = (windowsbasedmultiviewAppDelegate *)[[UIApplication sharedApplication] delegate];
    FirstViewController *newView  = [[FirstViewController alloc] initWithNibName:@"FirstViewcController" bundle:nil];
    [delegate switchView:self.view toView:newView.view]; -- It failed here

}

The following is the code for the switchView

-(void)switchView:(UIView *)view1 toView:(UIView *)view2{
    [UIView beginAnimations:@"Animation" context:nil];
    [UIView setAnimationDuration:.75];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.window cache:YES];
    [view1 removeFromSuperview];
    [_window addSubview:view2];
    [UIView commitAnimations];

}

I'm using Xcode4 and IOS 4.3. Thank you very much


Solution

  • You might've gotten the NIB name wrong here

    initWithNibName:@"FirstViewcController"
    

    Probably it should be,

    initWithNibName:@"FirstViewController"
    

    Note the additional c.