简体   繁体   English

如何使用编程从iPhone电话簿拍摄图像?

[英]how to take image from iphone phonebook using programming?

有两种正常的导入图像的方法(从相机和相册导入),但是我也想拍摄iphone电话簿的图像,所以我该怎么办?

Below can be used for getting image from AddressBook 下面可用于从AddressBook获取图像

NSData  *imgData = (NSData *)ABPersonCopyImageData(person);

UIImage  *img = [UIImage imgaeWithData:imgData];

where person is of type ABRecordRef . 其中person是ABRecordRef类型。 Now as CFData and NSData are 现在就像CFDataNSData

toll-free bridged 免费桥接

, so you can simply type cast CFData to NSData and get the image ,因此您只需将CFData键入NSData并获取图像

Here is the Tutorial 这是教程

http://adeem.me/blog/2009/04/02/get-image-from-contact-stored-in-addressbook/ 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 . 如果使用“电话簿”来表示要访问联系人数据的AddressBook框架,请尝试使用Erica SadunAB可可包装纸 It includes a sample project, so it will be easy. 它包括一个示例项目,因此很容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM