UITabBarController的TabBar稍微隐藏
我的 UITabBarController 的 tabBar 稍微偏离视图,请告诉我我的代码有什么问题:
LoggedInViewController *lvc = [[[LoggedInViewController alloc]
initWithAccount:account] autorelease];
[self presentModalViewController:lvc animated:YES];
- (void)viewDidLoad
{
self.tabController = [[UITabBarController alloc] init];
LoggedInFeedNavigationController *navController;
navController = [[LoggedInFeedNavigationController alloc]
initWithAccount:self.account];
[self.tabController setViewControllers:
[NSArray arrayWithObject:navController]];
[self.view addSubview:self.tabController.view];
[super viewDidLoad];
}
My UITabBarController's tabBar is slightly off the view, please can you tell me what is wrong with my code:
LoggedInViewController *lvc = [[[LoggedInViewController alloc]
initWithAccount:account] autorelease];
[self presentModalViewController:lvc animated:YES];
- (void)viewDidLoad
{
self.tabController = [[UITabBarController alloc] init];
LoggedInFeedNavigationController *navController;
navController = [[LoggedInFeedNavigationController alloc]
initWithAccount:self.account];
[self.tabController setViewControllers:
[NSArray arrayWithObject:navController]];
[self.view addSubview:self.tabController.view];
[super viewDidLoad];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将 tabController 视图添加为子视图,但尚未指定它应位于其父视图中的位置,或者当父视图更改大小时应如何调整其大小。尝试以下操作:
注意:您不是 需要调用
[super viewDidLoad]
,但如果您确实决定调用它,则应该在viewDidLoad 方法的开头,而不是结尾。You are adding the tabController view as a subview, but you have not specified where it should be located within its parent view, or how it should be resized when the parent view changes size. Try the following:
Note: you are not required to call
[super viewDidLoad]
, but if you do decide to call it, you should call it at the beginning of yourviewDidLoad
method, and not at the end.