开发者

Problem with pushviewcontroller animation while fetching iPhone contact's image

开发者 https://www.devze.com 2023-02-13 04:18 出处:网络
I am trying to show a contact from the iPhone address book. I fetch the names and image of the contacts. Then I pass these details to Detail view.

I am trying to show a contact from the iPhone address book. I fetch the names and image of the contacts. Then I pass these details to Detail view.

Now the problem is when I push the detail view, the animation is very slow and choppy. This happens only when I fetch the contact detail which has image. The pushviewcontroller animation works perfectly fine when the contact detail does not con开发者_如何转开发tain image.

Also I noticed that this problem occurs only in iPhone 4.0. When I tested this on iPhone 3gs, it worked perfectly. So I am thinking this might be device specific problem.

I fetch the contact name in the following way:

 ABAddressBookRef addressBook = ABAddressBookCreate();
ABRecordRef record=ABCFindPersonMatchingPhoneNumber(addressBook,
                                                    number, 0, 0);

if(record)
{
    NSString *name=(NSString *)ABRecordCopyCompositeName(record);
   NSLog(@"Contact Name %@",name);

}

And I fetch the contact image in the following way:

     if (record && ABPersonHasImageData(record))
    {

        CFDataRef data;
        data = ABPersonCopyImageData(record);
        if (data)
        {
            NSLog(@"ImageFound");
            imageData=[[NSData alloc] initWithData:(NSData *)data];

        }
    }

Then I pass the imageData to the Detail View

DetailView *detail=[[DetailView alloc] initWithNibName:@"DetailView" bundle:nil];
detail.imageData=imageData
[self.navigationController pushViewController:detail animated:YES];

How can I improve on this?


I know this is an old thread, but just in case if someone comes to this here with a related problem: add

[detail view];

right after the initialization and before setting any @properties (detail.imageData=imageData;) - because the outlets of the segue are not set yet.

0

精彩评论

暂无评论...
验证码 换一张
取 消