我有 iPad 项目,它在 Xcode 4.X 上完美运行,但是当我将 Xcode 更新到 5.0 时出现了问题。
如果我不深入细节,我有2个场景。通过单击测验场景中的图像,应用程序加载大图片场景。通过点击大画面场景中的屏幕,应用程序返回测验场景。
在新的 Xcode 中,当我从大图片场景返回测验场景时,所有操作都不起作用(例如,我无法再次转到大图片。单击图像 - 不去大图片,但 NSLog 显示该应用程序试图加载大图片场景)
QuizViewController.m:
-(IBAction)showBigPicture:(id)sender
{
[self performSegueWithIdentifier:@"gotoBigPicture" sender:self];
}
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([segue.identifier isEqual:@"gotoBigPicture"])
{
ELBigPictureSceneViewController *vc = [segue destinationViewController];
vc.currentQuestion = _currentQuestion;
vc.currentPackage = _currentPackage;
}
}
BigPictureViewController.m:
- (void)viewWillAppear:(BOOL)animated
{
NSLog(@"big picture viewWillAppear");
NSLog(@"%@",_currentQuestion.image_uri);
NSString *imageNameJPG = [[NSString alloc] initWithFormat:@"%@.jpg",[_currentQuestion image_uri]];
_imageView.image = [UIImage imageNamed:imageNameJPG];
[super viewWillAppear:(BOOL)animated];
}
- (IBAction)gotoQuiz:(id)sender
{
[self performSegueWithIdentifier:@"backToQuiz" sender:self];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([segue.identifier isEqual:@"backToQuiz"])
{
ELQuizViewController *vc = [segue destinationViewController];
vc.currentQuestion = _currentQuestion;
vc.currentPackage = _currentPackage;
}
}
NSLog 显示“_currentQuestion.image_uri”的正确值,但场景未第二次加载。此外,该项目在较旧的 Xcode 中运行良好。