iOS Tutorials: Advanced AlertController

This tutorials contains three parts in which you are able to customize your alert controller by either putting in more functionality such as more than one buttons or adding textfield to request information.

 As always, open XCode and create your own projects and give it a name.

On my Main.storyboard, I have created three buttons to showcase different UIAlertController here in which I intend to showcase different UIAlertController with different buttons pressed. This could be easily done by going to the bottom right and type button and drag out three button onto the Main.storyboard and rename it.

 

Then I’ll connect those buttons to the UIViewController and create an Action in which if I clicked on the button, it will pop up the desired alert controller that I want. If you would like to have two screen like what I did in below, locate on your top right that you will see 2 circle overlap with each other. Click that and you will two separate screen here. Then remember to press Control + Drag onto the ViewController and change the connection to Action indicating what would happen if the button is pressed.

The alert controller above could be easily achieve by writing the code below.

The next alert controller will showcase two buttons instead of one button.

This could be easily done by writing the code below

The last alert controller here requires you to input your information which is shown below

And this could easily be done by writing the code below.

The overall result of the alert controller

 

The following code is uploaded on GitHub

  • Article By :
    Founder of DaddyCoding. Studied Computer Science, Information System and Information Technology at BYU-Hawaii. Currently spending most of my time researching and learning on helping to expose making iOS apps.

Random Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*