美文网首页
使用swift判断是否第一次安装

使用swift判断是否第一次安装

作者: 超越时空的思念_8a22 | 来源:发表于2017-09-18 07:30 被阅读0次

//定义一个BOOL值,将获取的值不会空

let show:Bool = (UserDefaults.standard.object(forKey: "show") != nil)

//判断

if show == false{

//判断赋予的值是否相同

UserDefaults.standard.set(true, forKey: "show")

//初始化

let vc = ViewController()

//添加到根视图

self.window?.rootViewController = vc

}else{

//定义位置

window = UIWindow(frame: UIScreen.main.bounds)

//背景颜色

window?.backgroundColor = UIColor.white

//进入跳转页面的位置

window?.rootViewController = DiBuViewController()

//定义key值

window?.makeKeyAndVisible()

}

相关文章

网友评论

      本文标题:使用swift判断是否第一次安装

      本文链接:https://www.haomeiwen.com/subject/ahsvsxtx.html