0
我只是試圖將我的UIWindow
暫時置於狀態欄上方以作警示之用。爲什麼我不能讓新的UIWindow出現在狀態欄上方?
的代碼非常簡單:
let newwindow = UIWindow(frame: UIScreen.mainScreen().bounds)
newwindow.hidden = false
newwindow.backgroundColor = UIColor.greenColor()
newwindow.windowLevel = UIWindowLevelStatusBar + 1.0
newwindow.makeKeyAndVisible()
newwindow.hidden = false
然而,當我把我的根視圖控制器的viewDidAppear
,我從來沒有看到這個窗口。
我在做什麼錯?
你是否試圖將它放在'viewWillApper'或'viewDidLoad'中? – Jeff