- 2008-11-26 (水) 17:16
- iPhone SDK / Cocoa / Objective-C
階層構造のデータのナビゲーションに使う”UINavigationController”で、その階層構造を水平方向に遷移させたい場合(例えばリスト表示のビューから詳細表示のビューに遷移するアプリで、ある項目の詳細ビューから別の項目の詳細ビューへリスト表示のビューを経由せずに直接遷移したい場合)は、UINavigationControllerのviewControllersプロパティをいじってやればよい。
[self.navigationController pushViewController:nextViewController animated:YES]; NSMutableArray *viewControllers = [NSMutableArray arrayWithArray:self.navigationController.viewControllers]; [viewControllers removeObjectAtIndex:([viewControllers count]-2)]; self.navigationController.viewControllers = viewControllers;
ただ、この方法だと遷移後に標準のNavigationBarItem(”Back”など)が消えてしまうという問題があるみたいです。自分でset***BarButtonItemしたボタンは問題なく表示されるので、今作っているアプリではとりあえず大丈夫ではあるのですが。
関連する投稿
- Newer: CocoaとWin32APIのフローは似ている
- Older: iPhone 3G は日本国内で何台売れたのか
Comments:0
Trackbacks:0
- Trackback URL for this entry
- http://iphone-dev.ensites.net/archives/15/trackback
- Listed below are links to weblogs that reference
- UINavigationControllerで水平方向の遷移をする from iPhoneアプリ開発ブログ