我正在学习如何在没有Interface Builder(即故事板,xib等)的情况下创建iOS应用程序.下面是我正在使用的基本应用程序委托类.问题是,当显示时,UIWindow不会用完设备的全屏(参见附件截图).这发生在我测试的所有设备和模拟器上.为什么不使用全屏?
import UIKit @UIApplicationMain class AppDelegate: UIResponder,UIApplicationDelegate { lazy var window: UIWindow? = { debugPrint("AppDelegate: Creating Window") let screen: UIScreen = UIScreen.mainScreen() let window: UIWindow = UIWindow.init(frame: screen.bounds) window.backgroundColor = UIColor.whiteColor() return window }() lazy var rootViewController: ShapesViewController = { debugPrint("AppDelegate: Creating Root View Controller") let rootViewController = ShapesViewController.init(nibName: nil,bundle: nil) return rootViewController }() func application(application: UIApplication,didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool { debugPrint("AppDelegate: applicationWillEnterForeground") window?.rootViewController = rootViewController window?.makeKeyAndVisible() return true } }
解决方法
问题是我没有发布图像或故事板.由于某些原因没有这个,应用程序默认为3.5“大小.相信这个评论:
A launch storyboard or xib must be provided unless the app requires full screen
原文地址:https://www.jb51.cc/iOS/327822.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。