我将 ViewController 作为子视图添加到我的主视图中,如下所示:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Backstage" bundle:nil];
UIViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"BackstageHomeViewController"];
vc.view.frame = CGRectMake(0, 0, 480, self.view.frame.size.height);
[self.view addSubview:vc.view];
问题是,UINavigationBar 仍然具有原始的全屏宽度,并且在边缘看起来被切断了。
如何更改宽度以匹配它包含的视图?