IOS Photo Operations (Get information and modify photos) detailed _ios

Source: Internet
Author: User

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.