Creating a view to enter user name and password on iPhone

I want to overlay on the main storyboard a view with textfields for entering user name and password.
Is there a standard approach to do this?
Need I create a new window with a new view for the textfields?

I would be very grateful for a hint where I can get an info about this topic or perhaps a hint how to do this.

Thank you very much

Answered by ahzzheng in 612631022
Do you want the view with the textfields to be visible at all times, or appear when a button is pressed?

If you want it to be visible at all times, you can just drag-and-drop a view from the object library (press the + at the top right of Xcode). You can add some textfields from there too. Once you've added all the elements, you need to connect the text fields' delegate to you main view controller. Check out this tutorial.

If you want it to appear when a button is pressed or similar, you can drag the view into the Scene Dock. This way, the view is hidden, but you can still configure all the subviews and add the text fields. To show the view, you'll need to connect the view to your main view controller with an IBOutlet. Tutorial

You don't need to create a new window (you almost never use windows (UIWindow) in iOS. They're just a container for your views, and the app provides one for you automatically).


Accepted Answer
Do you want the view with the textfields to be visible at all times, or appear when a button is pressed?

If you want it to be visible at all times, you can just drag-and-drop a view from the object library (press the + at the top right of Xcode). You can add some textfields from there too. Once you've added all the elements, you need to connect the text fields' delegate to you main view controller. Check out this tutorial.

If you want it to appear when a button is pressed or similar, you can drag the view into the Scene Dock. This way, the view is hidden, but you can still configure all the subviews and add the text fields. To show the view, you'll need to connect the view to your main view controller with an IBOutlet. Tutorial

You don't need to create a new window (you almost never use windows (UIWindow) in iOS. They're just a container for your views, and the app provides one for you automatically).


If I understand correctly you can create a new viewController , link it to your main one with a "show segue" , then you click on your new controller and in "presentation" you can choose "page sheet", so you kinda have a new view controller over your main one where you can perform your signIn/signup
It seems you have a good understanding of the different UI elements. Like you said, you would use two UITextFields in order to allow the user to input their username/password.

In order to directly answer your first question:
There is no standard way of implementing a login screen in an app, but here is a link to many examples of some:
pttrns.com/?scid=17

Most of the time there’s no need to create a new window for this, in general you shouldn’t have interaction with the app’s window.

Lastly, it is important to note that if you are implementing a sign up/log in system, and it will have social media login options, you must comply with App Store Review Guideline 4.8: https://developer.apple.com/app-store/review/guidelines/#sign-in-with-apple



Creating a view to enter user name and password on iPhone
 
 
Q