开发者

iPhone Creating Different Themes

开发者 https://www.devze.com 2023-02-23 01:17 出处:网络
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 pos开发者_如何转开发sible to load, one

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 pos开发者_如何转开发sible 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消