1

我有一个添加 viewController 的 UITabBarController,但定位已关闭。屏幕顶部有大约 20px 的间隙,加载的 viewController 的底部是隐藏的。如何移动调整加载的 viewController 的大小?

viewController = [[FlashCardViewController alloc] initWithNibName:@"FlashCardViewController" bundle:[NSBundle mainBundle]];
viewController.view.bounds = [[UIScreen mainScreen]bounds];
//viewController.view.alpha = 0.0;
//[self.view addSubview:viewController.view];

tabBarController = [[UITabBarController alloc] initWithNibName:nil bundle:nil];
tabBarController.viewControllers = [NSArray arrayWithObject:viewController];
tabBarController.view.alpha = 0.0;
[self.view addSubview:tabBarController.view];

我尝试了这两种方法,但没有运气。

tabBarController.view.bounds = [[UIScreen mainScreen] bounds];
tabBarController.view.frame = [[UIScreen mainScreen] bounds];

无论如何,这并不是我真正想要做的。我想将它们设置为 tabBarController 查看窗口的大小和位置。

4

3 回答 3

5

我最终手动创建了框架矩形:

tabBarController.view.frame = CGRectMake(0,0,320,460);
于 2009-08-28T19:04:18.380 回答
1

20 像素听起来很像状态栏的高度。

我建议您打开您的 FlashCardViewController.xib 文件并仔细检查“模拟界面元素”下的视图,您在“状态栏”中没有选择任何内容。然后应该将您的视图向上移动 20 像素。

于 2009-08-25T00:00:35.787 回答
1
CGRect screenArea = [[UIScreen mainScreen] applicationFrame];

tabBarController.view.frame = CGRectMake(0,0,screenArea.size.width,screenArea.size.height);
于 2011-03-23T16:14:31.773 回答