UIView Ориентация Пейзаж - PullRequest
       0

UIView Ориентация Пейзаж

0 голосов
/ 28 февраля 2011

Мне нужно показать вид, который охватывает весь экран. Для этого я использую этот код:

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];

Проблема в том, что мне нужно показывать в альбомном режиме, потому что когда отображается вид, он появляется в портретном режиме (хотя ipad находится в альбомном режиме и viewController тоже).

Есть идеи?

Спасибо

Ответы [ 2 ]

2 голосов
/ 01 марта 2011

установить преобразование в ваш 'modalView', как это:

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

и примените одно и то же преобразование ко всем подпредставлениям внутри 'modalView', надеюсь, это должно сработать.

1 голос
/ 28 февраля 2011

Вы изменили mustAutorotateToInterfaceOrientation на вашем viewController?

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...