图像未显示在UICollectionViewCell上

G.P*_*ddy 8 image objective-c uicollectionview ios8

我试图在联系人上获取图像,这里我使用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= [UIImage imageWithData:(__bridge NSData *)ABPersonCopyImageDataWithFormat(person, kABPersonImageFormatThumbnail)];
        }

    } else {

        NSString *imageUrlString = @"http://www.google.co.in/intl/en_com/images/srpr/logo1w.png";
        NSURL *url = [NSURL URLWithString:imageUrlString];
        NSData *data = [[NSData alloc] initWithContentsOfURL:url];
        img= [UIImage imageWithData:data];

    }
    NSString *string ;//
     string =[NSString stringWithFormat:@"%@",img];
    NSLog(@"%@",img);
    self.name.text=name;
    self.number.text=phone;
    [self.nameArray addObject:name];
   [self.imageArray addObject:string];
    NSLog(@"%@",self.nameArray);
      NSLog(@"%@",self.imageArray);
    [self.collectionView reloadData];


    [self.collectionView performBatchUpdates:^{
        [self.collectionView reloadSections:[NSIndexSet indexSetWithIndex:0]];
    } completion:nil];

}
Run Code Online (Sandbox Code Playgroud)

最后一个像这样的图像数组

(
    "add-button.png",
    "<UIImage: 0x17e56c80>, {148, 148}"
)
Run Code Online (Sandbox Code Playgroud)

在图像阵列上,每个图像,如显示.PNG格式,它将显示正常,然后如何修改它.能否请你建议我怎么解决这个问题,谢谢.

tt_*_*rah 0

在故事板上,选择图像并查看属性面板。

底部有“已安装”选项。选中最上面的“已安装”框。

已安装