开发者

Show custom contact information

开发者 https://www.devze.com 2023-03-10 04:11 出处:网络
So I h开发者_Python百科ave an MKMapView and I have a pin on it with a disclosure button.I want the user to be able to tap the disclosure button and the navigation controller to push a new view control

So I h开发者_Python百科ave an MKMapView and I have a pin on it with a disclosure button. I want the user to be able to tap the disclosure button and the navigation controller to push a new view controller. But I want that new view controller to look like the contacts viewController that comes standard in the contacts app. I need it to display custom contact information because the contact will not be in the users contacts. I have been playing around with ABPerson, but I can't figure it out. I want that contact page to look exactly like the standard page. This is what I've been playing with:

    ABPersonViewController *view = [[ABPersonViewController alloc] init];

ABPerson *person;

ABRecordRef ABPersonCreate (
                            void
                            );

view.personViewDelegate = self;
view.displayedPerson = person;
view.allowsEditing = NO;

[self.navigationController pushViewController:view animated:YES];
[view release];

I'm not really sure what to do. The contact information I want to display will include Business title, Address, Phone Number, and stuff like that.

Thank you very much in advance.


Here is how it should be done:

    ABUnknownPersonViewController *newPersonViewController = [[ABUnknownPersonViewController alloc] init];
    newPersonViewController.displayedPerson = [self personObject];
    [self.navigationController pushViewController:newPersonViewController animated:YES];

and than to respond to the [self personObject]

- (ABRecordRef)personObject {

    // Create a new Person object.
    ABRecordRef newRecord = ABPersonCreate();

    // Setting the value to the ABPerson object.
    //ABRecordSetValue(newRecord, kABPersonKindOrganization, @"Business Name", nil);    


    ABMutableMultiValueRef multiPhone = ABMultiValueCreateMutable(kABMultiStringPropertyType);
    ABMultiValueAddValueAndLabel(multiPhone, @"1-555-555-5555", kABPersonPhoneMainLabel, NULL);
    ABRecordSetValue(newRecord, kABPersonPhoneProperty, multiPhone,nil);
    CFRelease(multiPhone);


    return newRecord;
}
0

精彩评论

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