【问题标题】:UIView alway show full screen in simulator although setting width and height to 320 x 320 px by Interface BuilderUIView 总是在模拟器中显示全屏,尽管通过 Interface Builder 将宽度和高度设置为 320 x 320 像素
【发布时间】:2011-11-24 13:02:21
【问题描述】:

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

我希望 UIView 显示在 TabBar 上,并且在屏幕底部有 TabBar。

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

这是我的代码。

//在 TabBarWithHomeAppDelegate.m - (BOOL)application:(UIApplication *)application 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;

界面构建器短屏幕

在模拟器中

这是我的源代码

link to download source code

任何建议都很有价值。

谢谢,

【问题讨论】:

  • 模式视图在 iPhone 上总是全屏显示。您需要使用 UIView 作为当前 UIViewControllers 视图的子视图。

标签: iphone ios uiview uiviewcontroller interface-builder


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2015-08-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多