there are two normal ways to import images (from camera and from album) but I also want to take images of 开发者_如何学运维iphone phonebook, so what should I do ?
Below can be used for getting image from AddressBook
NSData *imgData = (NSData *)ABPersonCopyImageData(person);
UIImage *img = [UIImage imgaeWithData:imgData];
where person is of type ABRecordRef
. Now as CFData
and NSData
are
toll-free bridged
, so you can simply type cast CFData
to NSData
and get the image
Here is the Tutorial
http://adeem.me/blog/2009/04/02/get-image-from-contact-stored-in-addressbook/
If with "phonebook" you mean AddressBook framework to access contacts data, try using Erica Sadun's AB cocoa wrapper. It includes a sample project, so it will be easy.
精彩评论