iPhone - 像短信联系人视图一样查看

发布于 2024-09-17 18:37:59 字数 565 浏览 3 评论 0原文

我正在尝试在 iPhone 消息(SMS)应用程序中实现类似于联系人视图的视图。 在iPhone上撰写消息时,会有“+”按钮用于添加联系人。单击“+”时,它将显示联系人列表,只需选择一个联系人,就会在“收件人”文本字段中添加联系人姓名。 我找到以下代码来显示联系人。但是,单击联系人后,它会显示有关该联系人的更多详细信息,但只是未选中。

    ABPeoplePickerNavigationController* picker;
picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;

CGRect newFrame = picker.view.frame;
newFrame.size.height = newFrame.size.height - 49;
picker.view.frame = newFrame;

[self presentModalViewController:picker animated:NO];
[picker release];

有人可以指出我选择联系人的正确方法吗?

I'm trying to implement a view similar to contacts view in iPhone Message (SMS) app.
When composing a message on iPhone, there will be "+" button to add contacts. On click of "+", it will show list of contacts and just by selecting a contact, it will add the contact name in "To" text field.
I found following code to show contacts. But on click of a contact, its showing more details about the contact and just not selected.

    ABPeoplePickerNavigationController* picker;
picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;

CGRect newFrame = picker.view.frame;
newFrame.size.height = newFrame.size.height - 49;
picker.view.frame = newFrame;

[self presentModalViewController:picker animated:NO];
[picker release];

Can some body point out me correct way to select a contact?

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

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

发布评论

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

评论(1

别理我 2024-09-24 18:37:59

我找到了解决方案。
我必须实现委托方法来处理这个问题。
以下是委托方法

- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker {

[self dismissModalViewControllerAnimated:YES];

}

- (BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person 

{




[自我解雇ModalViewControllerAnimated:是];

return NO;

}

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person 
                            property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier

{
返回否;
}

I found the solution.
I've to implement the delegate methods to handle that.
The following are the delegate methods

- (void)peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker {

[self dismissModalViewControllerAnimated:YES];

}

- (BOOL)peoplePickerNavigationController: (ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person 

{
.
.
.
.
[self dismissModalViewControllerAnimated:YES];

return NO;

}

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person 
                            property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier

{
return NO;
}

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