Search code examples
iphoneobjective-cipaduiimageviewlayoutsubviews

Change background image on ipad after rotation


I show bg of my app using UIImageView. To support correct interface rotation i write layoutSubviews method. In this metod .frame property changes correctly, but when i try change image of UIImageView just like this:

view = [self viewWithTag:1002];    
 ((UIImageView *)view).image = [UIImage imageNamed:@"portrait.png"];

nothing changed. Did I do something wrong or is it impossible to change image of UIImageView in layoutSubviews method?


Solution

  • try this

    - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
    
        // change background here
    
        }