简体   繁体   English

如何将一个UIimageView的图像设置为另一个UIImageView的背景?

[英]How to set the image of one UIimageView as background of other UIImageView?

How to set the image of one UIimageView as background of other UIImageView? 如何将一个UIimageView的图像设置为另一个UIImageView的背景?

I am using 2 viewcontrollers. 我正在使用2个viewcontrollers。 In 1st view, I am using an imageview & I want this image as background of other imageView of 2 viewcontroller 在第一个视图中,我正在使用imageview,并且我希望此图像作为2个viewcontroller的其他imageView的背景

If the two controllers are connected via a segue you can expose the ImageView in the header of the second controller and set that in the "prepareForSegue" method like that: 如果两个控制器是通过segue连接的,则可以在第二个控制器的标题中公开ImageView,并在“ prepareForSegue”方法中进行设置,如下所示:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    SecondViewController *upcoming = segue.destinationViewController;
    if ([[segue identifier] isEqualToString:@"yourSegue"]) {
        upcoming.imageView.image = self.imageView.image;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM