私は2 UIViewController
を持っていて、UINavigationBarをUINavigationBar & UINavigationItemに入れたいと思っています。しかし、私のコードはここ..2 UIViewControllerのためのUINavigationControllerを作成
を働いていない私のコードです:
#import "testView1.h"
#import "testView2.h"
@interface testView1()
@end
@implementation testView1
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor darkGrayColor];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:self];
testView2 *detail = [testView2 new];
[navController pushViewController:detail animated:YES];
}
以下のように、あなたは、ストーリーボードを使用していますか? – Subramanian
実際にあなたがここでやっているのは、ウィンドウにすでに存在しているrootviewコントローラを持つナビゲーションコントローラをallocして初期化するだけだということです。このステップは、適切な結果のために、AppDelegateで行うべきではありません –
@Subramanianいいえ私はストーリーボードでUIViewControllerを作成し、それをtestView1に設定します –