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)?
AddressBook框架提供ABPersonCopyImageData以获取每个地址簿条目的联系人图像。这对于图像数据非常有用,但是用户还可以对图像进行调整大小和裁剪以用于构图。当我获得图像数据时,我得到完整的图像,而不是裁剪的图像。如何获取用户用于裁剪图像的帧(或者代替该帧,如何访问裁剪的图像/数据)?
3 个解决方案
#1
6
iOS 4.1 adds a new method: ABPersonCopyImageDataWithFormat
in ABPerson
.
iOS 4.1添加了一个新方法:ABPerson中的ABPersonCopyImageDataWithFormat。
I'm using it like this:
我这样使用它:
NSData *imageData = [(NSData *)ABPersonCopyImageDataWithFormat(recordRef, kABPersonImageFormatThumbnail) autorelease];
The formats allowed are:
允许的格式是:
kABPersonImageFormatThumbnail
kABPersonImageFormatOriginalSize
This allows you to get the original image or the cropped image (thumbnail).
这允许您获取原始图像或裁剪图像(缩略图)。
#2
1
To some extent, it's a bug in iOS4. Previously, the address book API returned cropped data, and in iOS4 it returns the whole image data. Some people want one, some people want the other. I tend to think the whole image data is useless without the cropping frame, so hopefully that will get fixed...
在某种程度上,这是iOS4中的一个错误。以前,地址簿API返回裁剪数据,而在iOS4中它返回整个图像数据。有些人想要一个,有些人想要另一个。我倾向于认为没有裁剪框架的整个图像数据都是无用的,所以希望能得到修复......
#3
0
I think it's impossible to get the crop rect. The crop rect information is stored inside the sqlite database that managed by addressbook framework. But client's application cannot read another application's sqlite database, according to the sandbox structure.
我认为不可能让庄稼直截了当。 crop rect信息存储在由addressbook框架管理的sqlite数据库中。但根据沙箱结构,客户端的应用程序无法读取另一个应用程序的sqlite数据库。
#1
6
iOS 4.1 adds a new method: ABPersonCopyImageDataWithFormat
in ABPerson
.
iOS 4.1添加了一个新方法:ABPerson中的ABPersonCopyImageDataWithFormat。
I'm using it like this:
我这样使用它:
NSData *imageData = [(NSData *)ABPersonCopyImageDataWithFormat(recordRef, kABPersonImageFormatThumbnail) autorelease];
The formats allowed are:
允许的格式是:
kABPersonImageFormatThumbnail
kABPersonImageFormatOriginalSize
This allows you to get the original image or the cropped image (thumbnail).
这允许您获取原始图像或裁剪图像(缩略图)。
#2
1
To some extent, it's a bug in iOS4. Previously, the address book API returned cropped data, and in iOS4 it returns the whole image data. Some people want one, some people want the other. I tend to think the whole image data is useless without the cropping frame, so hopefully that will get fixed...
在某种程度上,这是iOS4中的一个错误。以前,地址簿API返回裁剪数据,而在iOS4中它返回整个图像数据。有些人想要一个,有些人想要另一个。我倾向于认为没有裁剪框架的整个图像数据都是无用的,所以希望能得到修复......
#3
0
I think it's impossible to get the crop rect. The crop rect information is stored inside the sqlite database that managed by addressbook framework. But client's application cannot read another application's sqlite database, according to the sandbox structure.
我认为不可能让庄稼直截了当。 crop rect信息存储在由addressbook框架管理的sqlite数据库中。但根据沙箱结构,客户端的应用程序无法读取另一个应用程序的sqlite数据库。