所以这是一个场景,我有一个SearchController,它可以显示我的应用程序联系人列表中的过滤结果,也可以显示在我的地址簿中。
推送ABPersonViewController的代码出现在我的didSelectObject:atIndex方法中。代码如下:
TableCellClass *selectedCell= (TableCellClass *)[self.tableView cellForRowAtIndexPath:indexPath];
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef arrayOfAllPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
ABRecordRef thisPerson = CFArrayGetValueAtIndex(arrayOfAllPeople,selectedCell.contactIndex);
ABPersonViewController *picker = [[ABPersonViewController alloc]init];
picker.personViewDelegate = self;
picker.displayedPerson = thisPerson;
picker.allowsEditing = YES;
[self.navigationController pushViewController:picker animated:YES];这个代码块在标准TTTableViewController上工作得很好,但是在我的searchController上却不能工作。

顺便说一下,这是屏幕截图。因此,正如您所看到的,不存在NavigationController。这是Three20的默认值。带有地址簿图标的单元格是在点击手势时启动ABPersonViewController的项目
发布于 2011-11-17 15:47:21
所以我找到了解决我的问题的办法。
首先,我创建了一个ABPersonViewController的子类。然后创建了我自己的-initWithNavigatorURL:query:方法。
在作为我的SearchDisplayController的TTTableViewController类上,在-didSelectObject:atIndexPath:方法中,我有这样一段代码:
TTTableItemCell *selectedCell= (TTTableItemCell *)[self.tableView cellForRowAtIndexPath:indexPath];
ABAddressBookRef addressBook = ABAddressBookCreate();
CFArrayRef arrayOfAllPeople = ABAddressBookCopyArrayOfAllPeople(addressBook);
ABRecordRef thisPerson = CFArrayGetValueAtIndex(arrayOfAllPeople,selectedCell.contactIndex);
ABPersonViewController *picker = [[ABPersonViewController alloc]initWithNibName:nil bundle:[NSBundle mainBundle]];
picker.personViewDelegate = self;
picker.displayedPerson = thisPerson;
picker.allowsEditing = YES;
NSNumber *allowsEditing;
if (picker.allowsEditing) {
allowsEditing = [[NSNumber alloc]initWithInt:1];
}
else{
allowsEditing = [[NSNumber alloc]initWithInt:0];
}
TTURLAction *urlAction = [[[TTURLAction alloc] initWithURLPath:@"tt://GJABPersonView"] autorelease];
urlAction.query = [NSDictionary dictionaryWithObjects:[NSMutableArray arrayWithObjects:self, thisPerson,allowsEditing, nil] forKeys:[NSMutableArray arrayWithObjects:@"personViewDelegate",@"displayedPerson",@"allowsEditing", nil]];
urlAction.animated = YES;
[[TTNavigator navigator] openURLAction:[urlAction applyTransition:UIViewAnimationTransitionFlipFromLeft]];
[allowsEditing release];它在导航时不会像正常情况下那样具有动画效果,但它可以完成以下工作:)
发布于 2011-11-15 16:57:12
您的searchController是如何呈现的?它有导航控制器吗?
检查self.navigationController是否不为空。
https://stackoverflow.com/questions/8132768
复制相似问题