小编G.P*_*ddy的帖子

图像未显示在UICollectionViewCell上

我试图在联系人上获取图像,这里我使用UICollectionViewCell但是在集合视图中我没有得到联系人的图像,我只得到姓名和号码.这里我的代码是

- (IBAction)ContactDisplay:(id)sender {

    _addressBookController = [[ABPeoplePickerNavigationController alloc] init];
    [_addressBookController setPeoplePickerDelegate:self];
    [self presentViewController:_addressBookController animated:YES completion:nil];



}
- (void)peoplePickerNavigationController:(ABPeoplePickerNavigationController*)peoplePicker didSelectPerson:(ABRecordRef)person
{
    [self displayPerson:person];
}



    - (void)displayPerson:(ABRecordRef)person
{
    NSString* name = (__bridge_transfer NSString*)ABRecordCopyValue(person,
                                                                    kABPersonFirstNameProperty);
    NSLog(@"%@",name);
    NSString* phone = nil;
    ABMultiValueRef phoneNumbers = ABRecordCopyValue(person,
                                                     kABPersonPhoneProperty);
    if (ABMultiValueGetCount(phoneNumbers) > 0) {
        phone = (__bridge_transfer NSString*)
        ABMultiValueCopyValueAtIndex(phoneNumbers, 0);
    } else {
        phone = @"[None]";
    }
    NSLog(@"%@",phone);
    UIImage *img ;

    if (person != nil && ABPersonHasImageData(person)) {
        if ((&ABPersonCopyImageDataWithFormat) != nil ) {

            img= …
Run Code Online (Sandbox Code Playgroud)

image objective-c uicollectionview ios8

8
推荐指数
1
解决办法
206
查看次数

标签 统计

image ×1

ios8 ×1

objective-c ×1

uicollectionview ×1