将多个 UIView 添加到 UIWindow 中。指定方向或仅遵从状态栏。考虑了状态栏的高度,您无需担心任何事情。
我们正在将它在 Agens 中用于自定义警报,但它可以用在任何地方。不应用作窗口的第一个视图。
AGWindowView 与现代构建 SDK 组合和 iOS 系统版本(iOS 5 ~ iOS 8)兼容。请确保您使用最新的标签/版本。
它可以在多种不同情况下使用。
支持可能的状态栏当前方向
AGWindowView *windowView = [[AGWindowView alloc] initAndAddToKeyWindow];
windowView.supportedInterfaceOrientations = AGInterfaceOrientationMaskAll;
[windowView addSubview:view];
即使您的应用程序处于纵向,也可以向上滑动一个视频播放器(例如横向上)
AGWindowView *windowView = [[AGWindowView alloc] initAndAddToKeyWindow];
windowView.supportedInterfaceOrientations = AGInterfaceOrientationMaskLandscapeLeft;
[windowView addSubviewAndFillBounds:player.view withSlideUpAnimationOnDone:nil];
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
注意:实际上这不会旋转状态栏,只会旋转 AGWindow。
请注意,我们正在使用 AGInterfaceOrientationMask
而不是 UIInterfaceOrientation
作为属性 supportedInterfaceOrientations
的值。
我强烈建议您设置 supportedInterfaceOrientations = AGInterfaceOrientationMaskAll
或仅使用一个方向,例如 supportedInterfaceOrientations = AGInterfaceOrientationMaskPortrait
。混合将会得到支持,但当前存在意外的结果。
它以 AGWindowView
的名称添加到公共 Cocoa pods spec 存储库中。