我展示一个作为的ABPeoplePickerNavigationController在我的应用程序选项卡。 用户点击一个名称,然后电子邮件地址,然后我做的电子邮件地址的东西。
后来,我想为他们选择淡出(不可亮)的人身和财产。
在一个正常的表,我会打电话deselectRowAtIndexPath。 但随着ABPeoplePickerNavCont我似乎没有能够访问它的表,我也不知道indexPath选择了什么,也没有为取消该行的API。
在大多数的应用程序,ABPeoplePickerNavCont有模式使用,因此也没关系,该行仍强调“引起了整个事情被驳回。 但是,在我的应用程序不会被搁置了(就像在手机应用程序中的联系人选项卡)。
有任何想法吗?
这是我在做什么......,似乎很好地工作。 我还加入了对号配件,当你选择/取消选择一个项目。 让我知道你的想法。 谢谢 :)
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
:
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;
[tableView deselectRowAtIndexPath:[tableView indexPathForSelectedRow] animated:YES];
}
希望这可以帮助。
驳回peoplepicker没有动画,然后在没有动画再次呈现它。 看起来不错。
- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person{
[self dismissModalViewControllerAnimated:NO];
[self presentModalViewController:peoplePicker animated:NO];
return NO;
}