开发者

how to take image from iphone phonebook using programming?

开发者 https://www.devze.com 2023-02-21 23:00 出处:网络
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 fr

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号