显示自定义联系信息 [英] Show custom contact information

查看:87
本文介绍了显示自定义联系信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个MKMapView,上面有一个带显示按钮的图钉.我希望用户能够点击显示按钮和导航控制器以推送新的视图控制器.但是我希望新的视图控制器看起来像联系人应用程序中的标准联系人viewController.我需要它来显示自定义联系人信息,因为该联系人将不在用户联系人中.我一直在和ABPerson玩耍,但是我无法弄清楚.我希望该联系页面看起来与标准页面完全一样.这就是我一直在玩的游戏:

So I have 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.

非常感谢您.

推荐答案

这里是应该怎么做:

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

,然后响应[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;
}

这篇关于显示自定义联系信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆