我需要显示一个覆盖整个屏幕的视图。为此,我使用以下代码:
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也是)。
有什么想法吗?
谢谢
发布于 2011-03-01 17:14:39
将转换设置为'modalView‘,如下所示:
self.modalView.transform = CGAffineTransformMakeRotation( ( 180 * M_PI ) / 360 );并将相同的转换应用于'modalView‘中的所有子视图,我希望它能起作用。
发布于 2011-02-28 20:50:13
你在你的viewController上修改shouldAutorotateToInterfaceOrientation了吗?
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}https://stackoverflow.com/questions/5142134
复制相似问题