diff --git a/Classes/APContact.h b/Classes/APContact.h index 92ce8f7..0876e74 100644 --- a/Classes/APContact.h +++ b/Classes/APContact.h @@ -19,6 +19,7 @@ @property (nonatomic, readonly) NSArray *phones; @property (nonatomic, readonly) NSArray *emails; @property (nonatomic, readonly) UIImage *photo; +@property (nonatomic, readonly) UIImage *photoThumb; - (id)initWithRecordRef:(ABRecordRef)recordRef fieldMask:(APContactField)fieldMask; diff --git a/Classes/APContact.m b/Classes/APContact.m index e2c8b05..a2c9aa8 100644 --- a/Classes/APContact.m +++ b/Classes/APContact.m @@ -43,6 +43,11 @@ - (id)initWithRecordRef:(ABRecordRef)recordRef fieldMask:(APContactField)fieldMa NSData *imageData = (__bridge_transfer NSData *)ABPersonCopyImageData(recordRef); _photo = [UIImage imageWithData:imageData scale:UIScreen.mainScreen.scale]; } + if (fieldMask & APContactFieldPhotoThumb) + { + NSData *imageData = (__bridge_transfer NSData *)ABPersonCopyImageDataWithFormat(recordRef, kABPersonImageFormatThumbnail); + _photoThumb = [UIImage imageWithData:imageData scale:UIScreen.mainScreen.scale]; + } } return self; } diff --git a/Classes/APTypes.h b/Classes/APTypes.h index e71ddd2..904ced8 100644 --- a/Classes/APTypes.h +++ b/Classes/APTypes.h @@ -28,10 +28,11 @@ typedef enum APContactFieldPhones = 1 << 3, APContactFieldEmails = 1 << 4, APContactFieldPhoto = 1 << 5, + APContactFieldPhotoThumb= 1 << 6, APContactFieldDefault = APContactFieldFirstName | APContactFieldLastName | APContactFieldPhones, APContactFieldAll = APContactFieldDefault | APContactFieldCompany | - APContactFieldEmails | APContactFieldPhoto + APContactFieldEmails | APContactFieldPhoto | APContactFieldPhotoThumb } APContactField; #endif