0
ライブラリNMBottomTabBarControllerを使用しています。 (参考のために。https://github.com/priankaliz/NMBottomTabBarController)AppDelegate.hでcutomTabBarをrootViewControllerに設定するにはどうすればよいですか?
私はtabBarControllerのプロパティを宣言しました。 didFinishLaunchingWithOptions
customTabBarController = (NMBottomTabBarController *)self.window.rootViewController;
customTabBarController.controllers = [NSArray arrayWithObjects:viewController1,viewController2,viewController3,viewController4 nil];
customTabBarController.delegate = self; HomeViewController *controller = [[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil];
[self.window setRootViewController:controller];
下AppDelegate.mで
@property (nonatomic, strong) NMBottomTabBarController *customTabBarController;
私はHomeVCでtableView
をしました。テーブルの下にある行がクリックされると、customTabBarControllerをrootViewController
に設定します。私が書いたものについて
- (void)tableView:(UITableView *)tableView1 didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
AppDelegate *appDelegate = [UIApplication sharedApplication].delegate;
[appDelegate.customTabBarController selectTabAtIndex:indexPath.row];
[appDelegate.window setRootViewController:appDelegate.customTabBarController.tabBarController];
}
このコードは機能しません。私はtabBarCotroller画面を取得していません。 正しい方法は何ですか?
。 – Namita