ationController上取消选择RowAtIndexPa

ationController上取消选择RowAtIndexPa

本文介绍了在ABPeoplePickerNavigationController上取消选择RowAtIndexPath的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用中将ABPeoplePickerNavigationController显示为选项卡。用户点击一个名字,然后点击电子邮件地址,然后我用电子邮件地址做一些事情。

I'm showing an ABPeoplePickerNavigationController as a tab in my app. The user clicks a name, then email address, then I do something with the email address.

之后,我想要他们选择的人和财产褪色out(不突出显示)。

Afterwards, I'd like for the person and property that they selected to fade out (not be highlighted).

在普通表中,我调用deselectRowAtIndexPath。但是对于ABPeoplePickerNavCont,我似乎无法访问它的表,也不知道选择了什么indexPath,也没有用于取消选择该行的API。

In a normal table, I'd call deselectRowAtIndexPath. But with the ABPeoplePickerNavCont I don't seem to have access to it's table, nor do I know what indexPath is selected, nor is there an api for deselecting the row.

在大多数应用程序中,ABPeoplePickerNavCont是以模态方式使用的,因此仍然突出显示该行并不重要,因为整个事情都被解雇了。但在我的应用程序中,它不会被解雇(就像电话应用程序中的联系人选项卡一样)。

On most apps, ABPeoplePickerNavCont is used modally so it doesn't matter that the row is still highlighted 'cause the whole thing gets dismissed. But in my app it does not get dismissed (just like the contacts tab in the Phone app).

任何想法?

推荐答案

这就是我正在做的......它似乎完美无缺。当您选择/取消选择项目时,我也会添加一个复选标记附件。让我知道你的想法。谢谢:)

This is what I'm doing... and it seems to work perfectly. I'm also adding a checkmark accessory when you select/deselect an item. Let me know what you think. Thanks :)

UIView *view = peoplePicker.topViewController.view;
UITableView *tableView = nil;
for(UIView *uv in view.subviews)
{
    if([uv isKindOfClass:[UITableView class]])
    {
        tableView = (UITableView*)uv;
        break;
    }
}

if(tableView != nil)
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:[tableView indexPathForSelectedRow]];

    cell.accessoryType = cell.accessoryType == UITableViewCellAccessoryNone ? UITableViewCellAccessoryCheckmark : UITableViewCellAccessoryNone;

    [cell setSelected:NO animated:YES];
}

这篇关于在ABPeoplePickerNavigationController上取消选择RowAtIndexPath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 06:06