在 ABPeoplePickerNavigationController 中自定义表格单元格
我花了一些时间在 SO 上搜索这个答案,但找不到它,所以这里是:
我从 ABPeoplePickerNavigationController 开始,当用户点击一个人时,他们将被带到 ABPersonViewController ,在那里他们将能够选择电话号码和电子邮件地址。使用完 ABPersonViewController 后,他们将被带回 ABPeoplePickerNavigationController。很简单的东西。
我想要的是在他们选择电话号码或电子邮件地址后,将详细标签添加到他们在 ABPeoplePickerNavigationController 中选择的表格单元格中。例如“选择的电子邮件和电话号码”或“选择的电话号码”。
Apple 的文档 说:
You should not need to subclass these controllers; the expected way to modify their behavior is by your implementation of their delegate.
提供的委托方法不会处理此问题。有什么方法可以在不将自己子类化的情况下完成此任务吗?而且,如果我确实必须子类化 ABPeoplePickerNavigationController,我将重写哪个方法来更新detailLabel?
谢谢!
I've spent some time searching for this answer on SO, but couldn't find it, so here goes:
I'm starting with an ABPeoplePickerNavigationController, and when a user taps a person, they'll be taken to an ABPersonViewController where they'll be able to select phone numbers and email addresses. After they're finished with the ABPersonViewController, they'll be taken back to the ABPeoplePickerNavigationController. Pretty simple stuff.
What I want is to add a detailLabel to the table cell they selected in ABPeoplePickerNavigationController after they chose a phone number or an email address. Something like "Email and phone number chosen" or "Phone number chosen".
Apple's documentation says:
You should not need to subclass these controllers; the expected way to modify their behavior is by your implementation of their delegate.
The delegate methods provided won't handle this. Is there any way to accomplish this without subclassing myself? And, if I do have to subclass ABPeoplePickerNavigationController, which method would I override to update the detailLabel?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

发布评论
评论(2)
我知道如何做到这一点,我认为这会对您有所帮助,但从未像这样实施过。
首先,您必须使用自定义表格。对于该表,您可以提供地址簿中的所有联系人姓名。您可以使用 http:// /developer.apple.com/library/mac/#documentation/userexperience/Reference/AddressBook/Classes/ABAddressBook_Class/Reference/Reference.html
只要浏览一下就可以理解。
你必须使用这些方法。
1) - (NSArray *)人
您会将所有人员记录放入返回的数组中。每条记录都有唯一的 id ,您必须检索它
ABRecord rec = [returnedArray objectAtIndex:0];
NSString *pid = rec.uniqueId
-(NSString *) uniqueId (这是 ABRecord 属性方法)
一旦获得它,您就可以通过使用该 recordid/unique id 从数组中退出您想要的内容。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
这段代码似乎对我有用,当用户选择一个人并添加复选标记时,它会抓取单元格。我猜此时您也可以通过其他方式调整单元格。
This bit of code seems to work for me, it grabs the cell when the user selects a person and adds a check mark. I'm guessing you can tweak the cell in other ways at this point as well.