我有UIImageView包含静态图像,我想获取此图像并将其设置在UIImage变量下。
我该怎么做?
答案 0 :(得分:11)
UIImageView *imageView = ... // Set from somewhere
UIImage *image = imageView.image; // Get the UIImage.
UIImage *otherImage = [UIImage imageNamed:@"Icon.png"]; // Load another image.
imageView.image = otherImage; // Change in the image in your UIImageView.
UIImageView Class Reference at developer.apple.com