2011-02-03 72 views
0

我是一个uiview组件,并将其添加到应用程序uiwindow中,如下所示。它可以在人像模式下正常工作,但当我进入lanscape模式时,它无法正常工作。它认为uiwindow仍然感觉自己在纵向模式下,尽管不是。如何在横向模式下运行?uiwindow风景模式问题

谢谢。

MyView的* popupView = [[MyView的页头] initWithFrame:方法CGRectMake(0,0,320,480) 网址:网址slidingType:slidingType html5Flag:_html5Flag];
//我改变帧CGRectMake(0,0480,320),但不工作

[popupView setTitle:self.currentAd.altText]; 
popupView.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5]; 

UIWindow* mainWindow = (((UIWindow*) [UIApplication sharedApplication].delegate).window); 

CGPoint middleCenter = popupView.center; 
CGSize offSize = [UIScreen mainScreen].bounds.size; 

CGPoint offScreenCenter = CGPointMake(offSize.width/2.0, offSize.height * 1.5); 

popupView.center = offScreenCenter; 
[mainWindow addSubview:popupView];  
popupView.center = middleCenter; 

回答

0

是你查看popupView autorized旋转?你需要在你的UIViewController类中实现这个方法:

- (void)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { 
    return YES; 
} 
+0

是的,我已经在上面的代码发布的控制器中实现了它。但问题似乎没有旋转uiwindow,因为我推动了它的观点。 – ysnky 2011-02-04 07:01:25