广告视图不旋转
我的应用程序中有两个视图控制器。 1-TabBar控制器 2-广告视图控制器 我将广告添加到标签栏上方,以便标签栏中的所有视图都可以看到它。
现在我的问题是,当我在 UIWindow 中添加广告视图时,它不会随屏幕旋转,但全屏广告工作正常(意味着它以设备的当前方向显示)。当我在选项卡栏控制器视图中添加广告时,它会旋转,但是当用户在横向模式下点击广告时。然后它会在视图的可见区域之外显示全屏广告。 任何帮助将不胜感激。
I have two view controller in my application.
1- TabBarController
2- Ad view Controller
I added the ads just above the tab-bar so that it can be visible for all the views in the tab-bar.
Now my problem is when i add the ad view in the UIWindow then it does not rotate with the screen but full screen ad work fine (means it is shown in the current orientation of device). When i add ad in tab-bar controller view then it rotates but when user taps on ad in landscape mode. then it shows full screen ad outside the visible area of the view.
Any help will be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
实施视图控制器遏制。观看 WWDC 2011 的实现 UIViewController Containment 视频,了解如何执行此操作。
Implement view controller containment. Watch the Implementing UIViewController Containment video from WWDC 2011 to learn how to do this.
将其添加到 UIViewController (在您的情况下添加到 TabBarController),而不是直接添加到 UIWindow。 UIViewController 类负责处理设备方向 UI 更改。
Add it to UIViewController (in your case to TabBarController) and not directly to UIWindow. UIViewController class is responsible for handling device orientation UI changes.
UIWindow 本身不会处理其子视图的旋转。但是,您可以将其添加到其第一个子视图中:
UIWindow itself will not handle rotation for its subviews. However, you can add it to its first subview: