初始化时 UiviewController 未按正确方向加载
我遇到了这个奇怪的问题。在应用程序委托中执行此操作 CGRect screenBounds = [[UIScreen mainScreen] 边界];
m_window = [[UIWindow alloc] initWithFrame: screenBounds];
m_view = [[GLView alloc] initWithFrame: screenBounds];
[m_window addSubview: m_view];
viewController=[[rcuivewcontroller alloc] initWithNibName:Nil bundle:Nil];
[m_view addSubview:viewController.view];
[m_window makeKeyAndVisible];
其中 m_view 是 UIView 类的对象,viewController 是 UIViewController 类的对象。 我通过在 uiviewController 的 shouldAutorotateToInterfaceOrientation() 方法中返回 true 横向方向,将 UIviewController 方向设置为 Landscaperight 。
接下来我将 uiviewController 的视图添加到 uiview 。问题是当我向 UIViewController 的视图添加另一个子视图(基本上是一个 adwhirlview 对象(adview))时,它以纵向模式出现。我不知道出了什么问题......
我观察到了这两点:
- 当我在 adview 上执行触摸事件并关闭广告窗口时,adview 进入我从一开始就想要的方向模式。
- m_view 基本上是一个 UIView,以纵向模式显示其子视图,无法更改。
I am having this strange problem . in the app delegate m doing this
CGRect screenBounds = [[UIScreen mainScreen] bounds];
m_window = [[UIWindow alloc] initWithFrame: screenBounds];
m_view = [[GLView alloc] initWithFrame: screenBounds];
[m_window addSubview: m_view];
viewController=[[rcuivewcontroller alloc] initWithNibName:Nil bundle:Nil];
[m_view addSubview:viewController.view];
[m_window makeKeyAndVisible];
where m_view is object of an UIView class and viewController is an object of UIViewController class.
Ihad set the UIviewController orientation to Landscaperight by returning true for landscape orientation in shouldAutorotateToInterfaceOrientation() method of uiviewController .
Next i added the uiviewController's view to uiview . The issue is when i add another subview which is basically a adwhirlview object (adview) to UIViewController's view it comes in portrait mode . I dont know whats going wrong ...
I observed these 2 important points :
- When i perform touch event on adview and close the ad-window the adview comes in orientation mode which i want from the beginning.
- The m_view which is basically a UIView is displaying its subviews in portrait mode which cant be changed .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论