我有一個UITabBarController添加一個viewController,但定位關閉。屏幕頂部有大約20px的間隙,並且加載的viewController的底部被隱藏。如何移動調整加載的viewController的大小?UITabBarController查看位置和大小
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查看窗口大小和位置。
感謝您的提示。我可以通過在viewWillAppear方法內使用self.tabBarController.view.frame = [[self view] frame]來快速計算出此代碼的數字。 – pulkitsinghal 2011-12-29 16:22:06