Gerardo
Gerardo

Reputation: 5830

UIView Orientation Landscape

i need to show a View that covers the whole screen. For that i use this code:

self.modalView = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.modalView.opaque = NO;
self.modalView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5f];
CheckBookAppDelegate *delegate = (CheckBookAppDelegate *)[UIApplication sharedApplication].delegate;

UIActivityIndicatorView *myIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
myIndicator.center = CGPointMake(160, 240);
[myIndicator startAnimating];
UILabel *label = [[[UILabel alloc] initWithFrame:frame] autorelease];
label.text = @"Enviando...";
label.textColor = [UIColor whiteColor];
label.font = [UIFont fontWithName:@"Arial Rounded MT Bold" size:(18.0)];
label.backgroundColor = [UIColor clearColor];
label.opaque = NO;
[label sizeToFit];
[self.modalView addSubview:label];
[self.modalView addSubview:myIndicator];
[delegate.window addSubview:modalView];
[myIndicator release];

The problem is that i need to show on landscape mode because when the view is shown it appears on portrait mode (although the ipad is on landscape mode and the viewController too).

Any ideas?

Thanks

Upvotes: 0

Views: 3567

Answers (2)

Dee
Dee

Reputation: 1897

set transformation to your 'modalView' like this:

self.modalView.transform = CGAffineTransformMakeRotation( ( 180 * M_PI ) / 360 );

and apply the same transformation to all the subview's inside the 'modalView', I hope it should work.

Upvotes: 2

zov
zov

Reputation: 4122

Did you change shouldAutorotateToInterfaceOrientation on your viewController ?

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

Upvotes: 1

Related Questions