比如 要从A 跳转到 B ,然后B 要求 呈现半透明, 正常情况 在B设置半透明背景 只会在动画过程中有效,动物执行完 就不是透明了 。
首先 A 页面
let v = Guide();
v.view.backgroundColor = UIColor.init(white: 0, alpha: 0.5);
self.present(v, animated: true, completion: nil);
然后在B(上述中的Guide) 页面的 的 viewDidLoad 中设置
self.modalPresentationStyle = .custom;