One of possible solutions would be to create a public property of application delegate holding your background image.
@property (strong) UIImage *globalBackground;
In your - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
you should initialize it either to some default image or last saved image.
self.globalBackground = [UIImage imageNamed:@"defaultBackground"];
Let's say your appDelegate header file is MyAppDelegate.h. You should import it in all the classes that use this default background image mechanism. Or simply add it to your Prefix.pch
file.
In your settings view controller you would then set:
//your background setting handler
MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
appDelegate.globalBackground = ... //however you get the selected image
//and here you set the background image of settings view controller
Then in each of the view controllets viewWillAppear:
you set its background in similar manner:
MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
//then you use appDelegate.globalBackground the same way you are doing it now
If you have a lot of view controllers you might want to consider creating a subclass of UIViewController
that implements this mechanism (possibly calling it UIViewControllerWithBackground
) and make all your view controllers subclasses of this class.
Note A: one would (instead of appDelegate's property) typically use a singleton class holding all the settings. It might be considered as a bad (quick & dirty) practice. More...
Note B: for saving the name of last selected background you could use NSUserDefaults
. This is out of the scope of this question and there is a lot of sample code available out there...