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)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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要对目标视图控制器中的图像视图执行某些操作。您可能想将视图添加到视图层次结构中。您可以在
viewDidLoad
或viewWillAppear:
中执行此操作。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 inviewWillAppear:
.