0

在此处输入图像描述

我试图找出设置窗口边界的位置。当前视图不会填满整个屏幕。

我刚刚开始了解 iOS 的 UI 设计。我没有在应用程序委托中设置 rootViewController,也没有实例化嵌入我的视图的导航控制器。

我已经尝试在 appDelegate 的 didFinishLaunching 方法中使用下面的代码。

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
self.rootVC= [[LaunchViewController alloc] init];
self.window.rootViewController =  self.rootVC;

[self.window makeKeyAndVisible];
return YES;

有人可以帮助我理解为什么这显示了我的观点。如果我删除添加的编码并只保留返回是,我的视图会加载,但就像我发布的图片一样。

在此处输入图像描述

编辑:

我需要标签和表格视图扩展到整个屏幕,而不仅仅是在左上角。我不知道为什么它会像这样加载而不是整个屏幕..请帮助

4

1 回答 1

2

这与窗口大小无关。这大约是您放入窗口的组件的大小。

如果您使用情节提要,则必须对视图进行一些限制。

你可以检查这个链接:

https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithConstraintsinInterfaceBuidler.html

于 2017-07-17T06:41:17.527 回答