In my app I have a gradient as a background. This gradient is made programmatically. The way that I now use this is like this:
I have a UIViewController which needs to display the gradient and in that class I do this :
- (void) viewWillAppear:(BOOL)animated{
[super viewDidAppear:animated];
[Gradient gradientInViewController:self];
}
This ain't so bad but this needs to be done in all the classes which isn't very good programming. What I want is instead of making a class a UIViewController, I want it to be a GradientViewController which is a subclass of UIViewController and in this class I will handle everything.
So my question is how do I do this? I think this has to be done through categories? But I can't figure out how to get the image on the screen. Should this be done in viewWillAppear or something?
[super viewWillAppea:animated];