1

我正在尝试遵循以下教程http://www.xcode-tutorials.com/multiview-application/

但我一直遇到

“无法在包中加载 NIB:'NSBunde....”

它在按钮单击事件中失败,以下是按钮单击事件的代码

-(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

}

以下是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];

}

我正在使用 Xcode4 和 IOS 4.3。非常感谢

4

1 回答 1

3

您可能在这里弄错了 NIB 名称

initWithNibName:@"FirstViewcController"

应该是吧

initWithNibName:@"FirstViewController"

注意额外的c.

于 2011-07-07T04:53:22.017 回答