I'm programming an application for road safety, and there will be a lots of code, so what I thought is I will divide each function into a class.
Now I'm trying to set the background of the main ViewController From another class, however it doesn't work. This is the code that I tried:
-(void)StartBackgroundAnimation
{
ViewController *MainRoot = [[ViewController alloc] init];
MainRoot.BackgroundViewer.image = [UIImage imageNamed:@"Lunch_Background.png"];
NSLog(@"ok");
}
What I did is that I created a function called StartBackgroundAnimation
, and I imported the main view-controller class, and I created an object from it. After that, I imported this class to the main view-controller, and I called this function but the image doesn't work.
Note: NSLog
works perfectly and the function is called however the image doesn't change.