IOS Photo Operations (Get information and modify photos)
Recently customers want a photo watermark, and modify other content including get location, and modify events etc, oh, yes, I think of the UIView variable UIImage method can be
<span style= "FONT-SIZE:14PX;" >-(uiimage*) Convertviewtoimage: (uiview*) v
{
cgsize s = v.bounds.size;
Uigraphicsbeginimagecontextwithoptions (S, NO, [UIScreen mainscreen].scale);
Cgcontextref context = Uigraphicsgetcurrentcontext ();
[V.layer Renderincontext:context];
UIImage *image = Uigraphicsgetimagefromcurrentimagecontext ();
Uigraphicsendimagecontext ();
V.layer.contents = nil;
return image;
} </span><span style= "FONT-SIZE:12PX;" >
</span>
But the addition of the content is the time of the photo and GPS status, a little privacy is not
Well, I thought of the callbacks in Uiimagepickercontroller that could take pictures or take them out of albums.
<span style= "FONT-SIZE:14PX;" >-(void) Imagepickercontroller: (Uiimagepickercontroller *) Picker Didfinishpickingmediawithinfo: (NSDictionary *) Info {</span>
<span style= "FONT-SIZE:14PX;" >//info There are big articles </span>
<span style= "FONT-SIZE:14PX;" >}</span>
OK first look at the photo, the photo info contains three parameters
<span style= "FONT-SIZE:14PX;" >uiimagepickercontrollermediametadata //Detailed data, everything about EXIF
uiimagepickercontrollermediatype /Type, Jpg,png this kind of
uiimagepickercontrolleroriginalimage
We need the data in Info[uiimagepickercontrollermediametadata] to find it. Time What the thieves detail
The next one is taken from the album, the album out of the info is three, but the
Uiimagepickercontrollermediametadata replaced uiimagepickercontrollerreferenceurl see the URL kiss Dad Ah, address.
IOS8 out. New Photo Gallery <Photos/Photos.h>
That ass used to be, and I'm not going to use it, huh?
<span style= "FONT-SIZE:14PX;" >phasset *asset = [Phasset Fetchassetswithalasseturls:@[asseturl] Options:nil][0];</span>
It's over? Well, the information is in the asset. The information inside is very full, just take it all right.
Notice that we sometimes need an address that just happens to have an address.
@property (Nonatomic,strong, readonly,nullable) cllocation *location;
In this, the inside by latitude and longitude, with latitude and longitude we want to restore the address, I thought this inside is the earth coordinates, did not think here is in line with our socialist core values of the Mars coordinates.
I also find ways to convert, this is directly put in wait for callback out of the address can be
Thank you for reading, I hope to help you, thank you for your support for this site!