调整UITabBarController子视图的大小
|
我确定这是我的问题,我不知道如何表达我的问题,但是我很茫然。
我正在开发一个带有2个子视图的应用程序,这些子视图将始终位于屏幕顶部(包括状态栏在内总共需要114个像素)。我希望其余空间由UITabBar占用,并且它是子视图。
我能够获得的最接近的选项卡视图的大小正确,但位置为0,0,因此它位于我的持久子视图下。
// Create the main toolbar
toolbar = [[UIToolbar alloc] init];
[toolbar sizeToFit];
toolbar.frame = CGRectMake(0.0, 20, 768, 44);
UILabel *textLabel = [[UILabel alloc] init];
textLabel.frame = CGRectMake(240, 20, 300, 40);
textLabel.textAlignment = UITextAlignmentCenter;
textLabel.backgroundColor = [UIColor clearColor];
textLabel.text = @\"Character Name\";
[self.window addSubview:textLabel];
[textLabel release];
...
// Create the stats bar
StatsViewController *statsView = [[StatsViewController alloc] init];
statsView.view.frame = CGRectMake(0.0, 64, 768, 50);
[self.window addSubview:statsView.view];
// Create Tab Bar Controller and Tab View Controllers
tabBarController = [[UITabBarController alloc] init];
...
[self.window setRootViewController:tabBarController];
[tabBarController release];
[self.window addSubview:toolbar];
[self.window bringSubviewToFront:statsView.view];
[self.window bringSubviewToFront:textLabel];
[self.window makeKeyAndVisible];
return YES;
没有找到相关结果
已邀请:
1 个回复
诞胃
,另一个用于选项卡栏控制器。现在,您将选项卡栏控制器的视图添加到一个容器视图,将“ 2”视图添加到另一个容器视图。 (注意:我没有对此进行测试。)