Search code examples
xcodeuser-interfaceuiimageviewuiswitch

let a view control a UIImage in another view


I have got a question. In my app I've got a settings screen and in the settings screen a UISwitch. When you would enable this switch the background of the home screen of the app would change. But how can I let the UISwitch control to another .nib? So I have a homescreen.nib and a settings.nib and I want to change the background of the homescreen.nib UIImageView, when I enable the UISwitch.

Thanks in advenced


Solution

  • Don't try to have your settings page control another page. Your settings page should allow the user to pick settings and save them. Any page which wants to use the settings should read the settings as needed.

    I would suggest using NSUserDefaults

    To write a setting [[NSUserDefaults standardUserDefauts] setObject:itemsToShow forKey:@"itemsToShow"];

    To read [[NSUserDefaults standardUserDefaults] integerForKey:@"itemsToShow"];