uiwindow横向模式问题
ia uiview compenent 并将其添加到应用程序 uiwindow 中,如下所示。它在纵向模式下工作正常,但当我进入横向模式时,它无法正常工作。它认为 uiwindow 仍然感觉自己处于纵向模式,尽管不是。如何才能以横向模式运行?
谢谢。
MyView* popupView = [[MyView alloc] initWithFrame:CGRectMake(0, 0, 320, 480) url:url sliderType: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;
i a uiview compenent and add it to application uiwindow like below. it works fine in portrait mode but when i oriante into lanscape mode it does not work properly. it think uiwindow still feels itself in portrait mode although not. how can run in landscape mode?
thanks.
MyView* popupView = [[MyView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)
url:url slidingType:slidingType html5Flag:_html5Flag];
// i change frame to CGRectMake(0, 0,480, 320) but not works
[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;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否查看 popupView 自动旋转?您需要在 UIViewController 类中实现此方法:
Is that you view popupView autorized to rotate ? You need yo implement this method in your UIViewController class: