Rotation in Safari with 5 web pages takes one second, in my app it takes four???

Discussion in 'iOS Programming' started by MythicFrost, Mar 5, 2011.

  1. MythicFrost macrumors 68040

    MythicFrost

    Joined:
    Mar 11, 2009
    Location:
    Australia
    #1
    Hi,

    In Safari with five tabs open each with Apple.com loaded, after rotating the device, the orientation changes after 1 second. In my test application which has five UIWebViews that have loaded Apple.com, it takes 4 or so seconds... but my test app has no other controls or code????

    How can this be? What's the deal here???

    Code for the UIWebViews:

    Code:
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        for (int i = 0; i<5; i++) {
            UIWebView *web = [[UIWebView alloc] initWithFrame:CGRectMake(50*i, 0, 320, 480)];
            NSURL *url = [NSURL URLWithString:@"http://www.apple.com"];
            NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
            
            web.scalesPageToFit = YES;
            
            web.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin;
            
            [self.view addSubview:web];
            
            [web loadRequest:requestObj];
        }
        
    }
    Anyone know what's happening and why???
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    Apple probably only rotate the visible view in real time then rotate the others in the background/on demand as they need to without animation.
     
  3. MythicFrost thread starter macrumors 68040

    MythicFrost

    Joined:
    Mar 11, 2009
    Location:
    Australia
    #3
    Ah thanks, I see, so they probably are rotating it manually then, too? You can't choose when to rotate them with autoResizingMasks can you?
     
  4. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    I'm assuming they have a custom view controller that handles rotation, the "tab" implementation and so on.
     
  5. MythicFrost thread starter macrumors 68040

    MythicFrost

    Joined:
    Mar 11, 2009
    Location:
    Australia
    #5
    Ah, I see... thanks :)
     

Share This Page