首页 文章

尽管Interface Builder将宽度和高度设置为320 x 320像素,UIView仍会在模拟器中显示全屏

提问于
浏览
0

我尝试将HomeViewController的UIView显示为TabBarViewController的模态 .

我希望UIView显示在TabBar上,屏幕底部有TabBar .

虽然将HomeController的宽度和高度的设置UIView设置为320 x 320像素并不会阻止视图显示全屏 . 它覆盖了UITabBar,当应用程序启动时,我无法在屏幕按钮上看到UITabBar .

这是我的代码 .

//在TabBarWithHomeAppDelegate.m中 - (BOOL)应用程序:(UIApplication *)应用程序didFinishLaunchingWithOptions:(NSDictionary *)launchOptions方法

homeViewController = [[HomeViewController alloc]
                      initWithNibName:@"HomeViewController" bundle:nil];


self.window.rootViewController = self.tabBarController;


[self.window makeKeyAndVisible];

self.tabBarController.view.frame = CGRectMake(0, 0, 320, 320);

[self.tabBarController presentModalViewController:homeViewController animated:NO];

return YES;

enter image description here

界面生成器短屏

在模拟器中

enter image description here

这是我的源代码

link to download source code

任何建议都很有 Value .

谢谢,

1 回答

  • 1

    您不应该像在当前上下文中那样使用带有标签栏的模态视图 . 相反,让 HomeViewController 视图全屏显示 . 要显示选项卡栏,请转到Interface Builder中的Simulated Metrics,然后选择底栏的Tab Bar . 这样,您的视图将不会是模态的,并且会被截断到导航栏和标签栏之间的空间 .

    HTH,

    阿克沙伊

相关问题