【问题标题】:ios5 how to pass prepareForSegue: a UIImageViewios5如何通过prepareForSegue:一个UIImageView
【发布时间】:2012-01-21 03:18:17
【问题描述】:

我想将加载了图像的 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 中说些什么才能使它起作用吗?

任何提示或建议???

谢谢

【问题讨论】:

    标签: ios xcode uiviewcontroller uiimageview segue


    【解决方案1】:

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

    【讨论】:

    • 我不太清楚你所说的做某事是什么意思。我是否需要分配,因为我不确定在我的目标视图控制器 ViewDidLoad 或 viewWillAppear 中放置什么
    • 没关系,我想通了。我添加了 [UIImageViewName setImage:UIImageView];
    猜你喜欢
    • 2011-12-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多