ios5如何传递prepareForSegue:一个UIImageView



我想通过单击按钮将已加载图像的UIImageView传递到不同ViewController中的不同UIImageView。

这是我的代码

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// Make sure your segue name in storyboard is the same as this line
if ([[segue identifier] isEqualToString:@"MY_SEGUE"])
{
    // Get reference to the destination view controller
    ViewControllerName *vc = [segue destinationViewController];
    // Pass the current UIImageView to a different UIImageView in a different view controller
    [vc setUIImageView:UIImageView2];
}
}

到目前为止,当我运行此程序时,加载下一个视图时不会发生任何事情。我没有错误。我需要在-(void)视图DidLoad中说些什么吗?

有什么建议吗???

感谢

您需要对目标视图控制器中的图像视图执行操作。您可能希望将视图添加到视图层次结构中。您可以在viewDidLoadviewWillAppear:中执行此操作。

最新更新