Activating the Settings Interface
Now that the Settings screen is set up with a Picker View and a switch, it’s time to work on storing the data for the user preferences. For the settings to work consistently, they should be set to some default values when the app first launches. The place to do that is in the app delegate, so open LMAAppDelegate.m and add the code in Listing 11.11 to the application:didFinishLaunchingWithOptions
: method.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ //Set default settings NSUserDefaults *settings = [NSUserDefaults standardUserDefaults]; //1 if([settings objectForKey ...
Get Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.