私は今、2つのことを達成しようとしています:
1) ナビゲーション コントローラー内にタブバー コントローラーを配置する
2)選択したタブに応じて、いくつかのナビゲーションボタンが変化し、現在選択されているタブ内に留まりながら、いくつかのビューをナビゲーションコントローラにプッシュしたい.
現在、ナビゲーション コントローラーを次のようにプッシュしています。
GenericAddViewController *vc = [[GenericAddViewController alloc]init];
UINavigationController *navigationController = [[UINavigationController alloc]initWithRootViewController:vc];
navigationController.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:navigationController animated:YES completion: nil];
次に、 GenericAddViewController.m 内に次のものがあります。
@interface GenericAddViewController ()
@property (strong, nonatomic) UITextField *titleTextField;
@property (nonatomic, strong) UITabBarController *tabBarController;
@end
@implementation GenericAddViewController
-(void)loadView
{
[super loadView];
TabOneController *tabOneController = [[TabOneController alloc]init];
tabOneController.title = @"Steps";
TabTwoController *tabTwoController = [[TabTwoController alloc]init];
tabTwoController.title = @"More Information";
NSArray *controllers = [NSArray arrayWithObjects:tabOneController, tabTwoController, nil];
self.tabBarController = [[UITabBarController alloc]init];
self.tabBarController.view.frame = CGRectMake(0, 0, 768, 1004);
self.tabBarController.viewControllers = controllers;
self.tabBarController.delegate = self;
}
これは機能します。唯一の問題は、たとえば TabOneController にあり、これらのいずれも実行できません。
UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(isDone:)];
[self.navigationItem setRightBarButtonItem:doneButton animated:NO];
[self.navigationController プッシュ...] もありません
そんなに複雑じゃないですか?!
どうもありがとう!