tags:

views:

46

answers:

1

Through ABPersonViewController we can edit contact's photo. Then How can we access the photo info by other way? However, we got ABPerson's image data as the big original picture but not the clip photo data as the ABPersonViewController show. Then what should we do? ABPersonCopyImageData, next?

A: 

+[UIImage imageWithData:]

To scale the image, something like

UIGraphicsBeginImageContextWithOptions(size, YES, 0);
[[UIImage imageWithData:data] drawInRect:(CGRect){{0,0},size}];
UIImage * scaledImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

(assuming size is the number of "points", for iPhone 4 support)

tc.
well, [UIImage imageWithData:] got the orignal size of photo, but not the corpping sized photo. What's the matter, because of ios4?
pcjbird
Crop it yourself? There's code around here somewhere...
tc.
Maybe, I think there are changes from ios3 to ios4. At or before ios3, we can access the clipped photo, however, since ios4, we can not.
pcjbird
Do you mean that the image is not scaled, or that it is not cropped? There's a big difference between the two.
tc.
I mean not cropped. The system image picker maybe can got the crop info, however, since the os4, we can not access the smaller cropped photo image of the contact.
pcjbird
Sorry, I see what you mean now. It's been asked before in http://stackoverflow.com/questions/3220187/ to which I've added a bounty.
tc.