iOS 从模态到非模态
iOS segue from modal to non-modal
我有一个电子邮件模式登录,我想从那里以非模式方式转到主屏幕。
目前流程有效,但以模态方式显示主屏幕。正常怎么呈现?
成功登录后从模态屏幕:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(identifier: "tabBarController")
// self.present(vc, animated: true) //works but modally
self.show(vc, sender: self) //works but modally
你可以这样做:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(identifier: "tabBarController")
vc.modalPresentationStyle = .overFullScreen
vc.modalTransitionStyle = .crossDissolve
self.show(vc, sender: self)
我有一个电子邮件模式登录,我想从那里以非模式方式转到主屏幕。
目前流程有效,但以模态方式显示主屏幕。正常怎么呈现?
成功登录后从模态屏幕:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(identifier: "tabBarController")
// self.present(vc, animated: true) //works but modally
self.show(vc, sender: self) //works but modally
你可以这样做:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(identifier: "tabBarController")
vc.modalPresentationStyle = .overFullScreen
vc.modalTransitionStyle = .crossDissolve
self.show(vc, sender: self)