views:

297

answers:

3

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 down 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.

+1  A: 

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)

Tomen
+2  A: 

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));
}
Brad Larson
I would love to try this but have a question. I do not use interface builder, so do not have a root view controller, at least not one I know of. Should I be adding that second snippet to something in particular? I have an app delegate but no root view controller.
Joey
What is the first view that you make a subview of your application's window? The controller for that should be the root view controller I refer to here.
Brad Larson
that first subview doesn't have a controller as far as I can tell, or perhaps I'm getting confused? Is there a way to reference its controller from the view if it definitely has one?Do all views route back to a parent controller in some way absolutely, or, if not, is there a simple way to designate the view as a view controller's view simply by allocating one and setting the view as viewController.view, or does that controller need to be further hooked into the application somehow?
Joey
In order to comply with the Model-View-Controller design pattern, you should have a controller of some sort for the fullscreen views that you present on the iPhone. Your business logic should reside in this view controller, not on the view or in a model object. You create and assign a view to be managed by a UIViewController in its -loadView, if you aren't using Interface Builder.
Brad Larson
A: 

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.

Joey