开发者

iphone landscape mode slow

The iphone app I am developing in landscape mode is seriously chugging. I put it in portrait for comparison and it appears to run much smoother in that orientation. I am not doing what I'd think is process intensive: a map view, some buttons, some labels, and some quartz drawing, yet some basic quartz animation seriously slows dow开发者_运维百科n really badly.

Does anyone know if landscape mode is just terribly handicapped compared to portrait, and/or if so, if there are better ways to create a landscape app? I simply use a root rotated view transformed 90 degrees and attach all my sub views to it.

Thanks.


There should be no real difference between landscape and portrait orientations when it comes to rendering performance. Are you using a transform to rotate your main view 90 degrees? As of iPhone OS 2.1, I believe, you no longer need to manually apply a transform to your main view to get it to start in landscape. All I had to do to force landscape orientation was to place this delegate method within my application delegate:

- (void)application:(UIApplication *)application willChangeStatusBarOrientation:(UIInterfaceOrientation)newStatusBarOrientation duration:(NSTimeInterval)duration;
{
    // This prevents the view from autorotating to portrait in the simulator
    if ((newStatusBarOrientation == UIInterfaceOrientationPortrait) || (newStatusBarOrientation == UIInterfaceOrientationPortraitUpsideDown))
        [application setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
}

and the following in my root view controller:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return ( (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}


Maybe you do some divisions which result in non-integer pixel positions ( like 0.76 ). I had some issues with performance when i had non-integer pixel positions. (Though i am not completely sure these were connected. But maybe it helps you)


Thank you for all your suggestions and help, everyone. I tried Brad's suggestion of setting the view controller autorotate settings and it worked extremely well. I think that was a huge contributing factor to the slowdown.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜