views:

88

answers:

1

Hey, I'm just trying to write a view based Application, which only uses the landscape Orientation.

Using this Code:

application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;

in the ApplicationDidFinishedLaunching Method the Application starts in landscape orientation.

The problem is, that if I create a landscape view in InterfaceBuilder, the view does not get shown up the way I created it... I need to create the view in portrait mode and imagine how it looks when it is in portrait mode (hope you understand what I mean?) - I insert already rotated images. So, I got everything work now, but the InfoButton doesn't rotate (as the other buttons, but the others are already rotated images)...

Whats my fault? How to I tell the Application to use my View, which I designed in Landscape orientation?

Thanks so much.

regards

A: 

You may have to rotate your view (button) dependent on orientation:

UIInterfaceOrientation orientation = [UIDevice currentDevice].orientation;
CGAffineTransform transform;
switch (orientation) {
    case UIDeviceOrientationPortrait:
        transform = CGAffineTransformIdentity;
        break;
    case UIDeviceOrientationPortraitUpsideDown:
        transform = CGAffineTransformMakeRotation(180*M_PI/180);
        break;
    case UIDeviceOrientationLandscapeLeft:
        transform = CGAffineTransformMakeRotation(90*M_PI/180);
        break;
    case UIDeviceOrientationLandscapeRight:
        transform = CGAffineTransformMakeRotation(-90.0*M_PI/180);
        break;
    default:
        transform = CGAffineTransformIdentity;
        break;
}
[[myView layer] setAffineTransform:transform];
Diederik Hoogenboom