Please try the following:
Answer 1: Do it in willRotateToInterfaceOrientation:duration:
method of your VC. This method is the animation method that is called when interface orientation changes and would give a smooth transition between background images.
Answer 2: Set your self.view.backgroundColor
with required image, in viewWillAppear:animated:
method taking self.interfaceOrientation
into account, which reflects the current interface orientation of the VC.
Ideally you can create a method like this:
-(void)setBackgroundForInterfaceOrientation:(UIInterfaceOrientation)orientation {
if (UIInterfaceOrientationIsLandscape(orientation)) {
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg-iphone3-landscape"]];
}
else {
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bg-iphone3"]];
}
}
Now call this method from either place:
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[self setBackgroundForInterfaceOrientation:toInterfaceOrientation];
}
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self setBackgroundForInterfaceOrientation:self.interfaceOrientation];
}
Hope it helps.