我们有一个UILabel
隐藏的登录屏幕,最初用于表示用户退出应用程序时的消息.
当在iOS中打开VoiceOver并且用户尝试从应用程序注销时,理想情况下应该读出注销消息标签.相反,它会读出登录屏幕的密码文本字段.
注销按钮的操作具有以下实现代码.
let loginStoryboard = UIStoryboard(name: "Login", bundle: nil)
let loginViewController = loginStoryboard.instantiateInitialViewController() as! LoginViewController
loginViewController.modalPresentationStyle = UIModalPresentationStyle.CurrentContext
loginViewController.logOut = true
self.presentViewController(loginViewController, animated: true, completion:nil)
Run Code Online (Sandbox Code Playgroud)
注销指示器设置为显示注销消息标签.
LoginViewController
viewDidLoad
码.
if(!logOut){
self.logOutMsg.hidden = true
}else{
self.logOutMsg.text = NSLocalizedString("LoggedOutMsg", comment: "Logged out message")
self.logOutMsg.hidden = false
}
Run Code Online (Sandbox Code Playgroud)
登录屏幕字段是故事板中启用的辅助功能.
行为不一致:有时会读取注销消息标签,有时会读出密码文本字段.每当VoiceOver读取密码文本字段时,我都会在控制台日志中看到错误.
|error| Could not find <UIWindow: 0x124d13b10; frame = (0 0; 768 1024); gestureRecognizers = <NSArray: 0x174241140>; layer = <UIWindowLayer: 0x1742319c0>> in a list of sorted view [parent: <CaseworkerApp.AppDelegate: 0x124e008e0>] siblings …
Run Code Online (Sandbox Code Playgroud)