ios5如何传递prepareForSegue:一个UIImageView

发布于 2024-12-28 02:21:15 字数 680 浏览 6 评论 0原文

我想将通过单击按钮加载图像的 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)viewDidLoad 中说些什么才能使其工作吗?

有什么提示或建议吗???

谢谢

I want to pass my UIImageView that has a image loaded into it from clicking a button to a different UIImageView in a different ViewController.

Here is my code

- (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];
}
}

So far when I run this nothing happens when I load the next view. I have no Errors. Do I need to say something in the - (void)viewDidLoad for this to work?

Any tips or suggestions???

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉宸 2025-01-04 02:21:15

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

You need to do something with the image view in your destination view controller. You probably want to add the view to your view hierarchy. You might do it in viewDidLoad or in viewWillAppear:.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文