O'Reilly logo

Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android by Michael Eierman, Jakob Iversen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

Listing 11.11 Saving Default Settings

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{    //Set default settings    NSUserDefaults *settings = [NSUserDefaults standardUserDefaults];         //1    if([settings objectForKey ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required