以下を定義しておく。
UIPopoverController *myPopoverController;
// MyTableView をPopoverControllerで表示するコード
// このときにUINavigationControllerを使う!
if( isIPad() ) {
if (!myPopoverController) {
MyTableView *controller = [[MyTableView alloc] initWithNibName: @"MyTableView" bundle: nil];
controller.delegate = self;
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:controller];
[controller release];
myPopoverController = [[UIPopoverController alloc]initWithContentViewController:navigationController];
myPopoverController.delegate = self;
[navigationController release];
}
if(!myPopoverController.popoverVisible) { // visible でない場合
[myPopoverController presentPopoverFromBarButtonItem:navigationBar.topItem.leftBarButtonItem
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
} else {
MyTableView *controller = [[MyTableView alloc] initWithNibName: @"MyTableView" bundle: nil];
controller.delegate = self;
controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:controller];
[controller release];
[self presentModalViewController:navigationController animated: YES];
[navigationController release];
}
後はMyTableView側で以下の制御をするだけ。
<ナビゲーション>
[[self navigationController] pushViewController:NewController animated:YES];
<復帰>
[[self navigationController] popViewControllerAnimated:YES];
0 件のコメント:
コメントを投稿