如何获取地址簿图像数据的裁剪框? [英] How do I get the cropping frame of the address book image data?

查看:114
本文介绍了如何获取地址簿图像数据的裁剪框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AddressBook框架提供ABPersonCopyImageData,用于获取每个地址簿条目的联系人图像。这对于图像数据非常有用,但是用户还可以对图像进行调整大小和裁剪以用于构图。当我获得图像数据时,我得到完整的图像,而不是裁剪的图像。如何获取用户用于裁剪图像的帧(或者代替该帧,如何访问裁剪的图像/数据)?

The AddressBook framework provides ABPersonCopyImageData for getting the contact image for each address book entry. This is great for the image data, but the user also sizes and crops the image for framing purposes. When I get the image data, I get the full image, and not the cropped image. How do I get the frame the user used to crop the image (or in lieu of that, how do I get access to the cropped image/data)?

推荐答案

iOS 4.1添加了一种新方法: ABPersonCopyImageDataWithFormat in ABPerson

iOS 4.1 adds a new method: ABPersonCopyImageDataWithFormat in ABPerson.

我正在使用它:

NSData *imageData = [(NSData *)ABPersonCopyImageDataWithFormat(recordRef, kABPersonImageFormatThumbnail) autorelease];

允许的格式为:

kABPersonImageFormatThumbnail
kABPersonImageFormatOriginalSize

这可以让你获得原版图像或裁剪后的图像(缩略图)。

This allows you to get the original image or the cropped image (thumbnail).

这篇关于如何获取地址簿图像数据的裁剪框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆