0
我花了一個月的iOS課程,發現內容有點過時,因爲Xcode的變化。在第四課中,老師教我們改變appDelegate.swift中的背景色,首先刪除故事板和viewController,同時刪除Info.plist中的「main」標籤。然後,他在代碼鍵入appDelegate.swift:在Xcode 8.2.1中更改背景顏色,無故事板和viewController
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
self.window?.backgroundColor = UIColor.magentaColor()
self.window?.makeKeyAndVisible()
return true
}
Then i found that there were updated codes on Github for this course. Unfortunately, it did't work either(but I know it's because it did not define "StaffPicksViewController"). 所以,我應該怎麼做才能改變背景顏色沒有故事板和ViewController?
'self.window =的UIWindow(幀:UIScreen.main.bounds) 自我。窗口?.backgroundColor = UIColor.magenta',mainScreen更改爲main,顏色Word(被認爲不必要)從UIColor屬性中移除,例如灰色,黑色和洋紅色。 –
是的,嘗試完全按照你之前的建議。我不知道它是什麼,但是我不知道它是什麼,但是我不知道它是如何工作的。有其他更好的解決方案嗎?還是要謝謝你的幫助。 –
你哪一行得到異常? –