Tutorial by Examples

UIAlertView and UIActionSheet are Deprecated in iOS 8 and Later. So Apple introduced a new controller for AlertView and ActionSheet called UIAlertController , changing the preferredStyle, you can switch between AlertView and ActionSheet. There is no delegate method for it because all button events a...
Good for quick notifications that don't require interaction. Swift let alert = UIAlertController(title: "Toast", message: "Hello World", preferredStyle: .Alert) presentViewController(alert, animated: true) { let delay_s:Double = 2 let delayTime = dispatch_time(DI...
Swift let alert = UIAlertController(title: "Hello", message: "Welcome to the world of iOS", preferredStyle: UIAlertControllerStyle.alert) let defaultAction = UIAlertAction(title: "OK", style: UIAlertActionS...
With UIAlertController, action sheets like the deprecated UIActionSheet are created with the same API as you use for AlertViews. Simple Action Sheet with two buttons Swift let alertController = UIAlertController(title: "Demo", message: "A demo with two buttons", preferredStyle...
One Button Swift class ViewController: UIViewController { @IBAction func showAlertButtonTapped(sender: UIButton) { // create the alert let alert = UIAlertController(title: "My Title", message: "This is my message.", preferredStyle: UIAlertCo...
Alert controller has a property which is used to put emphases on an action added in the alert controller. This property can be used to highlight a particular action for user attention.For objective C; @property(nonatomic, strong) UIAlertAction *preferredAction An action which is already added in...

Page 1 of 1