I have taken a imageview in applicationDidFinishLaunching as shown below.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIImageView* imageBg = [[UIImageView alloc]initWithFrame:CGRectMake(0, 20, 320, 460)];
imageBg.image = [UIImage imageNamed:@"AppBG.png"];
[self.window addSubview:imageBg];
[self.window sendSubviewToBack:imageBg];
}
Now In rootViewController I have one button
My need is that on press of button in RootViewController I want to change the image from AppBG.png to AppBG1.png
Make your
UIImageView,imageBgan property, synthesize it.Then Use following code on button click: