目前试图访问的UIImageView
一个UIImage
属性来实例化另一个UIImage
对象。只是我试图做到这一点。无法访问的UIImageView图像
UIImage *myImage = myExistingView.image;
但是该属性不会设置。我不断为myImage取得零值。
我想复制的图像,最终做这样的事情
UIImageView *newImageView = [[UIImageView alloc] initWithImage:myImage];
,但我似乎无法得到它。建议?
编辑。最近的尝试没有奏效。
UIImageView *newView = [[UIImageView alloc] initWithImage:[[UIImage alloc] initWithData:UIImagePNGRepresentation(myImageView.image)]];
多一点的代码可以帮助 –
哪里,愿意复制图像!我看到你发布的代码没有问题...你可以测试它是否保存了这样的图像 UIImage * image = myExistingView.image; 的UIImageView * imagev = [[ALLOC的UIImageView] initWithImage:图片]; [targetimageview setImage:imagev.image]; –
你在哪里/如何为myExistingView设置图像? – MikeS