I've used this tutorial to create a gradient background for my app. It looks beautiful. However there is a problem when I change the orientation.
It looks proper in portrait mode but in landscape orientation the gradient doesn't cover the entire view. I've uploaded a screenshot -
The red is the gradient and the blue part is the default background color which is supposed to be completely covered by the red gradient.
How can I cover entire view? I tried to call the gradient method after detecting rotation change but it didn't work. This is the code I used:
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(deviceOrientationDidChangeNotification:)
name:UIDeviceOrientationDidChangeNotification
object:nil];// this is in 'viewWillAppear' method
- (void)deviceOrientationDidChangeNotification:(NSNotification*)note
{
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
[self addBackground];
}