因为Parse处理Logging In,所以我想坚持使用Parse的默认登录/注册屏幕,我在空白的viewController上显示。
但是,为了更多地定制它,我想在登录/注册文本字段和按钮后面添加(最好是模糊的)背景图像。
我可以通过故事板将模糊图像放在View中,但是如何设置我弹出的logInViewController的背景,以便可以看到背景图像?
或者,如何通过LogInViewController上的调用放置模糊的背景图像? 到目前为止,我还没能完全按照自己的意愿去做。 我下面的代码将图像添加为patternImage,但我希望它能占用整个屏幕的背景。
func showLogInViewController(){
//build logInVC in Code: var logInViewController = PFLogInViewController() var logInLogoTitle = UILabel() logInLogoTitle.text = "Thredz" logInLogoTitle.font = UIFont(name: "Cochin", size: 40.0) logInViewController.fields = PFLogInFields.UsernameAndPassword | PFLogInFields.LogInButton | PFLogInFields.SignUpButton | PFLogInFields.PasswordForgotten | PFLogInFields.Twitter //| PFLogInFields.Facebook logInViewController.logInView?.logo = logInLogoTitle logInViewController.logInView?.backgroundColor = UIColor(patternImage: UIImage(named: "SFStreetcar")!) logInViewController.delegate = self //present log in VC self.presentViewController(logInViewController, animated: true, completion: nil)Because Parse handles Logging In so well, I want to stick with Parse's default Log In/Sign Up screen which I present over a blank viewController.
However, to customize it more I'd like to add (preferably blurred) background image behind the Log In/Sign up text fields and buttons.
I can place the blurred image in a View via the Storyboard, but how can I set the background of the logInViewController that I pop so the background image is visible?
Alternatively, how could place the blurred background image via a call on LogInViewController? So far I haven't been able to do exactly what I'm trying to do. My code below adds the image as a patternImage, but I want it to take up the entire screen's background.
func showLogInViewController() {
//build logInVC in Code: var logInViewController = PFLogInViewController() var logInLogoTitle = UILabel() logInLogoTitle.text = "Thredz" logInLogoTitle.font = UIFont(name: "Cochin", size: 40.0) logInViewController.fields = PFLogInFields.UsernameAndPassword | PFLogInFields.LogInButton | PFLogInFields.SignUpButton | PFLogInFields.PasswordForgotten | PFLogInFields.Twitter //| PFLogInFields.Facebook logInViewController.logInView?.logo = logInLogoTitle logInViewController.logInView?.backgroundColor = UIColor(patternImage: UIImage(named: "SFStreetcar")!) logInViewController.delegate = self //present log in VC self.presentViewController(logInViewController, animated: true, completion: nil)最满意答案
找到了解决方案:
logInViewController.logInView?.backgroundColor = UIColor.clearColor() loginViewController.modalPresentationStyle = UIModalPresentationStyle.OverCurrentContext...导致Parse Log In覆盖在我在故事板中设置的imageView上。
figured out a solution:
logInViewController.logInView?.backgroundColor = UIColor.clearColor() loginViewController.modalPresentationStyle = UIModalPresentationStyle.OverCurrentContext...results in the Parse Log In being overlayed over the imageView I set up in my storyboard.
更多推荐
发布评论