当我尝试在Swift中创建一个
此外,如果我尝试通过将其设置为根视图控制器来显示它,它永远不会被显示。
有人知道发生了什么吗???
UIViewController
实例时,即使我没有在视图控制器中定义任何指定的初始化程序(或其他内容,FWIW),所有继承的初始化程序都不可用。此外,如果我尝试通过将其设置为根视图控制器来显示它,它永远不会被显示。
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.makeKeyAndVisible()
window?.backgroundColor = UIColor.greenColor()
let vc = ImageViewController()
window?.rootViewController = vc
return true
}
视图控制器的代码只是Xcode的模板:
import UIKit
class ImageViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
有人知道发生了什么吗???