我是一名uiview的成员,并将其添加到应用程序uiwindow,如下所示。它在纵向模式下工作正常,但是当我进入lanscape模式时,它无法正常工作。它认为uiwindow仍然感觉自己处于肖像模式,尽管不是。如何在横向模式下运行?
感谢。
MyView * popupView = [[MyView alloc] initWithFrame:CGRectMake(0,0,320,480) url:url slidingType:slidingType html5Flag:_html5Flag];
//我将帧更改为CGRectMake(0,0,480,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 :(得分:0)
您是否查看弹出窗口授权旋转?您需要在UIViewController类中实现此方法:
- (void)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return YES;
}