0
我需要顯示一個涵蓋整個屏幕的視圖。對於我使用此代碼:UIView方向風景
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太)。
任何想法?
感謝
該代碼可能會讓您陷入麻煩 - 您應該明確檢查您想要支持的每個方向。如果有問題的用戶界面第一次進入橫向模式,那麼該代碼可能會中斷。 – occulus 2011-02-28 14:21:18
是的,它不工作...任何想法? – xger86x 2011-02-28 22:45:29
謝謝!!!它幫助了我 – Meir 2012-01-13 10:32:08