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
You might've gotten the NIB name wrong here
initWithNibName:@"FirstViewcController"
Probably it should be,
initWithNibName:@"FirstViewController"
Note the additional c
.
精彩评论