【发布时间】:2016-12-19 11:06:50
【问题描述】:
我不确定我的应用委托中发生了什么我完成了这段代码显示我的服务视图
func showServiceStartView()
{
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let secondViewController = storyBoard.instantiateViewControllerWithIdentifier("SERVICE_START_VC_ID")
self.window!.rootViewController = secondViewController
self.window!.makeKeyAndVisible()
}
但它给了我奇怪的行为。当视图切换时,它会显示额外的覆盖几秒钟然后消失。但我不想要额外的叠加层。
http://giphy.com/gifs/l0MYFCQ3LwV8r90m4
我正在处理这个Programmatically set the initial view controller using Storyboards
【问题讨论】:
-
你如何推 - 弹出视图控制器?在代码中。
-
@ZaidPathan 按钮反对调用此方法
-
转到您的
AppDelegate.Swift文件,您会看到它已经 有var window: UIWindow?,所以您现在正在使用另一个文件。您应该始终只有一个窗口。 大多数应用程序只需要一个窗口,在设备的主屏幕上显示应用程序的内容。您可以创建额外的窗口并将它们显示在设备的主屏幕上,但额外的窗口更常用于在连接的外部显示器上显示内容。阅读更多here