在AppDelegate.m中:我添加了标签栏:
[self.window addSubview:self.tabBarController.view];
在TrangchuViewController.m中:我想在顶部添加一个导航控制器来查看thongtinCanhanViewController。
- (void) pushThongtinCaNhan:(id)paramSender{
ThongtinCanhanViewController *thongtinCanhanViewController =[[ThongtinCanhanViewController alloc]
initWithNibName:nil
bundle:NULL];
[self.thongtinCanhanNavigationController pushViewController:thongtinCanhanViewController
animated:YES];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"trangchuBackground@2x.png"]];
self.thongtinCanhanViewController = [[ThongtinCanhanViewController alloc]
initWithNibName:nil
bundle:NULL];
self.thongtinCanhanNavigationController = [[UINavigationController alloc]
initWithRootViewController:self.thongtinCanhanViewController];
[self.view addSubview:self.thongtinCanhanNavigationController.view];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Setting"
style:UIBarButtonItemStylePlain
target:self
action:@selector(pushThongtinCaNhan:)];
}
但是,当开始时,虽然我在导航上有触摸按钮,但是thongtinCanhanViewController显示默认值。我不想要这个。 此外,为什么thongtinCanhanViewController在trangchuViewController下显示?它必须显示出来。
请帮我注意代码中的错误?非常感谢。