2011-11-15 28 views
0

因此,這裏是情景,我有一個SearchController,顯示過濾結果從我的應用程序列表中的聯繫人,也出現在我的地址簿。ABPersonViewController將不會顯示在推

推送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。

enter image description here

這裏順便說一下拍攝的畫面。所以你可以看到沒有NavigationController存在。這是Three20的默認設置。具有地址簿圖標的單元格是在點按手勢時啓動ABPersonViewController的項目

回答

0

所以我找到了解決方法來解決我的問題。

首先,我創建了一個類,它是ABPersonViewController的子類。然後創建我自己的-initWithNavigatorURL:query:方法。

的TTTableViewController類,它是我的SearchDisplayController,該-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]; 

它不會像動畫它的正常航行時沒有,但它確實工作:)

0

您的searchController如何呈現?它有導航控制器嗎?

檢查self.navigationController不是零。

+0

燁它擁有一個零值。那我該如何補救?創建一個新的navigationController是否會破壞Three20的導航映射? –

+0

不確定about20,但你需要得到一個有效的指針導航控制器。它是如何呈現的? – railwayparade

+0

我編輯了我的帖子供您查看屏幕截圖:) –