get image from image view?
Can I get 开发者_JS百科an image from image view? Please tell me what the code looks like..
UIImageView *imageview; //Assign to your image view
[imageview image];
https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIImageView_Class/Reference/Reference.html%23//apple_ref/doc/uid/TP40006889
Try This:
UIImage *setImg=[ UIImage imageNamed:@"testImg.png"];
To display the image in imageView
UIImageView *imgView=[UIImageView alloc]initWithImage:setImg];
To get Image from imageView
UIImage *getImg=imgView.image;
It really depends on what you want to do with the image, but if you just want to get a pointer to the image then you would do this.
UIImage *imageIWant = imageView.image;
I assume you have an UIImageView
instance imageview.
Use the below to get the UIImage
UIImage* myImage = [imageview image];
UIImageView *imageView;
UIImage *img = imageView.image;
img is image from UIImageView imageView.
精彩评论