我正在使用Parse&ParseUI。我希望我的PFLoginViewController子类具有透明的背景。将来,我想在背景上放置模糊的视图。
但是…。一旦完成PFLoginViewController的动画输入,背景就会变成黑色…而在动画过程中背景是透明的。
func presentLogin() { var loginViewController = LoginViewController() var signupViewController = SignUpViewController() loginViewController.fields = .UsernameAndPassword | .LogInButton | .PasswordForgotten | .SignUpButton | PFLogInFields.DismissButton signupViewController.fields = .UsernameAndPassword | .Email | .DismissButton | .SignUpButton loginViewController.delegate = self loginViewController.logInView.backgroundColor = UIColor.clearColor() loginViewController.logInView.opaque = false signupViewController.delegate = self loginViewController.signUpController = signupViewController self.presentViewController(loginViewController, animated: true) { () -> Void in // } }
我的logincontroller的子类:
class LoginViewController: PFLogInViewController { @IBOutlet weak var _nmcLogoLabel: UILabel! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. let userName = SettingsManager.userName let password = SettingsManager.password self.logInView.usernameField.text = userName self.logInView.passwordField.text = password NSBundle.mainBundle().loadNibNamed("LoginViewBranding", owner: self, options: nil)[0] as? UIView self.logInView.logo = _nmcLogoLabel } }
如何使其透明?
Ps将clearColor应用于子类中的backgroundColor没什么区别
解决它。
问题是presentViewController无法保留我所涵盖的视图。
viewController.modalPresentationStyle = .overCurrentContext
做到了。