Seti
Seti

Reputation: 21

How do I move UIView to front of ViewController Swift 3?

I am trying to build a sign up page with the option to use phone or email. In order to be able to send it to the server all of my views have to be in one view controller. So I am trying to figure out how I can move one view to the front of the controller when pressing a button.

Screenshot 1:

Screenshot 2:

Upvotes: 2

Views: 849

Answers (1)

JAB
JAB

Reputation: 3235

This is because you are trying to call it on the class SignUpView, rather than an instance of the class. bringSubview(toFront:) is an instance method.

It looks like you have changed the type of the view controller's view property to be SignUpView, but you can still access it by using view, like this:

view.bringSubview(toFront: yourEmailViewInstance)

Note that I have also changed your use of EmailView in your method call. You need to be using the property names you have assigned the instances of the views, not their class names.

Upvotes: 1

Related Questions