我使用以下代码从地址簿加载联系人图片:
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier{
UIImage *image = [UIImage imageWithData:(NSData *)ABPersonCopyImageData(person)];
return NO;
}
但是,此代码会返回存储的完整图像,而不是裁剪版本,它会显示在各种位置,例如地址簿。
答案 0 :(得分:4)
我在这里找到答案:https://stackoverflow.com/a/6953492/784318
NSData *imageData = (__bridge NSData*)ABPersonCopyImageDataWithFormat(person, kABPersonImageFormatThumbnail);
UIImage *image = [UIImage imageWithData:imageData];