ia uiview 组件并将其添加到应用程序 uiwindow,如下所示。它在纵向模式下工作正常,但是当我进入横向模式时它不能正常工作。它认为 uiwindow 仍然感觉自己处于纵向模式,尽管不是。怎么可以横屏运行?
谢谢。
MyView* popupView = [[MyView alloc] initWithFrame:CGRectMake(0, 0, 320, 480) url:url slipType: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;