tags:

views:

257

answers:

2

Hello all, I want to work in landscape mode only and so far the only way I can get the appropriate coordinate frame in the rest of the application is by rotating the main window using:

CGAffineTransformMakeRotation(3.1415/2.0f);

which rotates all subviews as well.

It works great, except when I want to draw UILabel, frame rate drops like crazy. I need the truncation and all those pretty things that come with UILabel so my question is, is there a better way of going into landscape mode or speeding up the text drawing. I've seen some applications that work in landscape mode and still have text, so I wonder...

+3  A: 

Maybe use CGAffineTransformMakeRotation(M_PI/2.0f); instead? This should produce a truly simple affine transform matrix.

KennyTM
Oh wow that was it, thanks. :)I don't quite understand why though. Doesn't it still multiply out the rest of the elements in the matrix?
Dogan Demir
With `M_PI/2.0f` your matrix is something like `[0, 1; -1, 0]`, while with `3.1415/2.0f` (an inaccurate value) you get `[4.6e-5, 0.99…; -0.99…, 4.6e-5]` which cause things very slow.
KennyTM
+2  A: 

If all that you want to do is work in landscape mode, as of iPhone OS 2.1 you don't need to apply a transform to your main view. See this answer to this question for more detail.

Brad Larson