I have a UIViewController (firstViewController) which has a button that ‘segue’s to another UIViewController (secondViewController). The first time secondViewController appears I want a UIAlertView to appear. Now I thought this would be easy at first – I thought i’d just create a boolean variable and set it to 1 after the UIAlertView is displayed for the first time. However I now realise that everytime the user hits back (to firstViewControllerand) and then again clicks on the button to display secondViewController, the boolean variable is reinitialized.
What’s the best practice for this sort of thing?
Thanks for any help!
Alex
This is a great use case for
NSUserDefaults. This allows you to storeBOOLs orint,float,NSString,NSDate, etc in a conveniently accessible way.Set the
BOOLusingand retrieve it using