Vikings
Vikings

Reputation: 2527

iPhone Creating Different Themes

I just want to make sure this is possible. Let's say I build three different views in interface builder, and they all have their own unique buttons/layout. Is it possible to load, one view based on what the user says in the settings. If so where should this been done. Any examples would be appreciated.

Upvotes: 1

Views: 381

Answers (1)

jnpdx
jnpdx

Reputation: 52387

Sure --

int userPref = [[NSUserDefaults standardUserDefaults] integerForKey:@"theme_pref"];

UIViewController *controller;
if (userPref == kOption1)
    controller = [[UIViewController alloc] initWithNibName:@"controller1" bundle:nil];
else if (userPref == kOption2)
    controller = [[UIViewController alloc] initWithNibName:@"controller2" bundle:nil];

Replace UIViewController with the name of your class. Also, that's just one way of retrieving the preference -- use whatever you want.

Upvotes: 2

Related Questions