ios - 覆盖 'Must Sign-in screen'的最佳实践

标签 ios swift

隐藏 UIViewController(或覆盖它)并与用户谈论“登录/注册”的屏幕的最佳做法是什么?

我想隐藏 Profile VC,因为必须先对用户进行身份验证。

最佳答案

这是你应该做的:

1:创建 2 个 View Controller (配置文件和登录/注册)

2: 在应用委托(delegate) didFinishLaunchingWithOptions 中查看用户是否 登录,如果不是点(在我的例子中我声明了 initialVC)他登录/注册这样的屏幕 也许:

if currentUser != nil{
self.window?.rootViewController = self.storyboard?.instantiateViewController(withIdentifier: "ProfileViewController")
}else{
self.window?.rootViewController = self.storyboard?.instantiateViewController(withIdentifier: "Login/RegisterViewController")
}

关于ios - 覆盖 'Must Sign-in screen'的最佳实践,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40105229/

相关文章:

iphone - 核心显卡 CGContextSetFillColorWithColor 未填充我的形状

ios - 阴影没有完全扩展 UIView 的宽度

ios - UIPageViewController 动画表示可以滑动

ios - 让 Chrome 假装成 iPad

swift - 如何删除已经呈现的不需要的 View 而不是呈现需要的 View ?

ios - 本地通知不适用于设备,但适用于模拟器

ios - 如何解决此 Spritekit (Swift 3) 错误?

ios - Admob 未显示在 ViewController 中

ios - 无限滚动 3d map

JSON 对象解析但省略了集合中的第一项