ABPeoplePickerNavigationController从联系Swift获取图像

时间:2015-02-24 10:49:52

标签: ios swift

有人可以告诉我,我怎样才能从被选中的Swift人物中获取图像?我使用ABPeoplePickerNavigationController ..

1 个答案:

答案 0 :(得分:1)

if ABPersonHasImageData(person ) {
    let profilePicture = UIImage(data: ABPersonCopyImageDataWithFormat(person, kABPersonImageFormatOriginalSize).takeRetainedValue())!
    let profilePictureThumbnail = UIImage(data: ABPersonCopyImageDataWithFormat(person, kABPersonImageFormatThumbnail).takeRetainedValue())!
    println("\(profilePicture)")
    println("\(profilePictureThumbnail)")
}