2

我使用以下代码从通讯录中加载联系人图片:

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier{

    UIImage *image = [UIImage imageWithData:(NSData *)ABPersonCopyImageData(person)];

    return NO;
}

但是,此代码返回存储的完整图像而不是裁剪版本,该图像显示在不同的位置,例如地址簿。

4

1 回答 1

4

我在这里找到了答案:https ://stackoverflow.com/a/6953492/784318

NSData *imageData = (__bridge NSData*)ABPersonCopyImageDataWithFormat(person, kABPersonImageFormatThumbnail);
UIImage *image = [UIImage imageWithData:imageData];
于 2012-01-23T14:04:48.003 回答