0

シナリオは次のとおりです。アプリの連絡先リストからフィルター処理された結果を表示し、アドレス帳にも表示される 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 を起動するアイテムです。

4

2 に答える 2

0

だから私は私の問題の回避策を見つけました。

まず、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-17T07:47:21.027 に答える
0

searchController はどのように表示されますか? ナビゲーションコントローラーはありますか?

self.navigationControllerが nil でないことを確認します。

于 2011-11-15T08:57:12.280 に答える