さて、ここに私の問題があります。私のアプリでは、iPhoneOS 画面の下部にあるタブ バーにカテゴリが表示されます。これにより、[MORE] ボタンが表示される前に 5 つのカテゴリしか許可されません。私は 25 を超えています (「申請内容を再考してください」などと答えないでください。これは前に無礼に言われました。これらは食べ物、飲み物などのカテゴリであり、変更できません)。ユーザーが自分のお気に入りをホームページに掲載できるようにしたいと考えています。Apple moreNavigationController 編集システムでは、編集ページのスペースの制約により、20 個のタブ バー項目のみを再配置できます。これでは不十分なので、独自の編集画面を実装する必要があります。rightBarButtonItem を nil に設定し、独自のものを作成しました。NSLogを使用すると、EDITボタンをクリックすると「クリック」が発生することがわかりますが、pushViewControllerを使用してプッシュすることはできません。何も起こりません。私が対処しているnavigationControllerと関係があると思います...しかし、よくわかりません。ps: これはすべて、UITabBarControllerDelegate と UINavigationControllerDelegate の両方として機能するアプリ デリゲートで発生します。
私は次のことをしようとしました:
- ( void )navigationController:( UINavigationController * )navigationController_local willShowViewController:( UIViewController * )viewController_local animated:( BOOL )animated
{
UIViewController * currentController = navigationController_local.visibleViewController;
UIViewController * nextController = viewController_local;
// Do whatever here.
NSLog(@"Nav contoller willShowViewController fired\n'%@'\n'%@'\nThere are currently: %d views on the stack\n",currentController,nextController,[self.navigationController.viewControllers count]);
if ( [nextController isKindOfClass:NSClassFromString(@"UIMoreListController")])
{
UINavigationBar *morenavbar = navigationController_local.navigationBar;
UINavigationItem *morenavitem = morenavbar.topItem;
morenavitem.rightBarButtonItem = nil;
NSLog(@"Is a UIMoreListController\n");
UIBarButtonItem *editTabBarButton = [[UIBarButtonItem alloc]
initWithTitle:@"Edit"
style:UIBarButtonItemStylePlain
target:self
action:@selector(editTabBar:)];
morenavitem.rightBarButtonItem = editTabBarButton;
[editTabBarButton release];
}
}
これは、画面の右上に編集ボタンを配置するために機能します-Appleのルックアンドフィールを模倣しています...しかし、そのボタンをクリックすると、くそmoreNavigationControllerを終了できません。
私は多くのことを試しました。UIAlerts などは機能しますが、スタック上のビュー コントローラーをプッシュ (またはポップ -- ルート ビューにポップすることも) は機能しません。
- (void) editTabBar:(id)sender {
NSLog(@"clicked edit tabbar\n");
NSLog(@"Total count of controllers: %d\n",[self.navigationController.viewControllers count]);
TabBarViewController *tabBarViewController2 = [[TabBarViewController alloc] initWithNibName:@"TabBarView" bundle:nil];
tabBarViewController2.navigationItem.title=@"Edit Tab Bar";
[self.navigationController pushViewController:tabBarViewController2 animated:YES];
[tabBarViewController2 release];
NSLog(@"finished edit tabbar\n");
}
moreNavigationController の表示ページで編集ボタンをクリックすると、予想どおりのログ エントリが取得され、(これは奇妙ですが) スタックのビューが上昇しますが、ページの変更は発生しません。正しいナビゲーション コントローラーを使用していないことを確認しましたが、使用するコントローラーを見つける方法がわかりません。
これも変なものです。編集機能でこれを行うと:
- (void) editTabBar:(id)sender {
self.tabBarController.selectedIndex = 0;
}
それは私を家に連れて行きます(tabbarcontroller 0へ)
しかし、これを行う:
- (void) editTabBar:(id)sender {
[self.navigationController popToRootViewControllerAnimated:YES];
}
動作しません。
moreNavigationController には、システムの残りの部分をねじ込む特別な品質がありますか?