从故事板加载场景

时间:2013-09-22 13:03:11

标签: ios objective-c xcode5

我有适用于iPad的项目,它完全适用于Xcode 4.X,但当我将Xcode更新为5.0时,出现了问题。

如果我不详细说明,我有2个场景。通过单击测验场景中的图像,应用程序加载大图片场景。通过点击Big Picture Scene中的屏幕,app返回Quiz Scene。

enter image description here

在新的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中运行良好。

0 个答案:

没有答案