Not to difficult, and I actually like the new way much better than the old.
This was the old code (still in Obj-C):
UIAlertView *av = [[[UIAlertView alloc]
initWithTitle:@"Error"
message:@"Oopsie daisy"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil] autorelease];
[av show];
let alert = UIAlertController.init(
title: "Error",
message: "Oopsie daisy",
preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(
title: "OK",
style: UIAlertActionStyle.Default,
handler: nil))
presentViewController(alert, animated: true, completion: nil)
I specifically like the way action items are added to the alert view. Makes a lot of sense, and we can associate a handler (closure) with each action. It is no longer necessary to demultiplex in a single action handler.
Did this help?, then please help out a small independent.
If you decide that you want to make a small donation, you can do so by clicking this
link: a cup of coffee ($2) or use the popup on the right hand side for different amounts.
Payments will be processed by PayPal, receiver will be sales at balancingrock dot nl
Bitcoins will be gladly accepted at: 1GacSREBxPy1yskLMc9de2nofNv2SNdwqH
We don't get the world we wish for... we get the world we pay for.
No comments:
Post a Comment