我正在尝试按照以下教程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。非常感谢你
答案 0 :(得分:3)
你可能在这里弄错了NIB名称
initWithNibName:@"FirstViewcController"
可能应该是,
initWithNibName:@"FirstViewController"
请注意额外的c
。