显示自定义联系信息

发布于 2024-11-13 03:54:09 字数 664 浏览 4 评论 0原文

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

    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];

我不太确定该怎么做。我想要显示的联系信息包括公司名称、地址、电话号码等。

预先非常感谢您。

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.

Thank you very much in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

时光病人 2024-11-20 03:54:09

这是应该如何完成的:

    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;
}

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;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文