Hello Friends, hope you read our first tutorial on Objective C where we taught you to display a basic message on your phone screen. If you’ve still not seen it then you can do so here:Be an iOS Developer with Kaavay-Part 1. Today we will be studying one of coolest features in IOS called the UIAlertView. To get a full understanding of this tutorial, you’ll have to refer to the above mentioned link, else the terms that we’ve used in the subsequent paras will be tough to grasp.
So as mentioned, this tutorial is going to help you display an alert message of your choice on your screen. But before digging into the code here is a snapshot of what your alert message will look like.
Looks great, doesn’t it? :)
Initially when I started with IOS development, displaying a message box in an iPhone application was something that I had to look up almost every time. So inorder to facilitate your task, I’ll try and cover up pretty much everything you'd need to know in order to show alerts in an iPhone application in this small tutorial.
So here we go with the actual coding. Given below is the code snippet that you will have to understand and write to get desired results.
Unlike a lot of other UI frameworks, the show function here does not block until the alert is dismissed. Rather execution will continue immediately. In order to know what button was pressed we're going to have to specify a delegate object. In the above example, you'll see the delegate argument is nil. Alternatively, we could provide an object that will act as a receiver for various actions as below.
The UIAlertViewDelegate ( You can find the link here ) has lots of helpful callbacks that can be used to determine how a user is interacting with your message box. The example above is probably one of the most common, determining which button was pressed when the view is dismissed.
Another great feature that it offers is, that you can also customize the alerts to your likes and needs. To get a better idea, here are a few pictures of some customized alerts.
Seems like fun, doesn’t it? So what are you waiting for? Get started with coding for displaying an alert message on your cool iPhone! Create amazing alerts as per your choice and make your customize your device as you like best.
Do write to us, in case of any difficulties or doubts, we’ll always be happy to help.
So as mentioned, this tutorial is going to help you display an alert message of your choice on your screen. But before digging into the code here is a snapshot of what your alert message will look like.
Looks great, doesn’t it? :)
Initially when I started with IOS development, displaying a message box in an iPhone application was something that I had to look up almost every time. So inorder to facilitate your task, I’ll try and cover up pretty much everything you'd need to know in order to show alerts in an iPhone application in this small tutorial.
So here we go with the actual coding. Given below is the code snippet that you will have to understand and write to get desired results.
Unlike a lot of other UI frameworks, the show function here does not block until the alert is dismissed. Rather execution will continue immediately. In order to know what button was pressed we're going to have to specify a delegate object. In the above example, you'll see the delegate argument is nil. Alternatively, we could provide an object that will act as a receiver for various actions as below.
The UIAlertViewDelegate ( You can find the link here ) has lots of helpful callbacks that can be used to determine how a user is interacting with your message box. The example above is probably one of the most common, determining which button was pressed when the view is dismissed.
Another great feature that it offers is, that you can also customize the alerts to your likes and needs. To get a better idea, here are a few pictures of some customized alerts.
Seems like fun, doesn’t it? So what are you waiting for? Get started with coding for displaying an alert message on your cool iPhone! Create amazing alerts as per your choice and make your customize your device as you like best.
Do write to us, in case of any difficulties or doubts, we’ll always be happy to help.
No comments:
Post a Comment