FCOverlay 1.0.7

FCOverlay 1.0.7

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布上次发布2016年2月

Almer Lucke 维护。



FCOverlay 1.0.7

  • Almer Lucke

FCOverlay 允许您在一个新窗口中展示新的视图控制器层级。

当您通过提供的方法之一呈现一个视图控制器时,它将在所有现有窗口顶部的新窗口中呈现(包括之前由 FCOverlay 生成的窗口)。这个新窗口是透明的,所以您可以使用它来创建 HUD、警告等...(运行示例项目以获取一些灵感)。

FCOverlay 的好处是,您不需要跟踪当前可见的视图控制器,并在该视图中呈现新的视图控制器。您可以从代码的任何地方直接在其他所有视图控制器顶部呈现和销毁任意的视图控制器。

FCOverlay 允许您将此呈现给用户,就像它只是一个“正常”控制器转换。示例代码展示了如何使用 iOS 7 自定义过渡、在不同的窗口级别(在上或低于状态栏)上方呈现,以及如何呈现警告类型视图控制器。

安装

最简单的方法是使用 CocoaPods。如果您还没有,这里有一个 指南

pod 'FCOverlay', '~>1.0.1'

使用

您可以使用 FCOverlay presentOverlayWithViewController 类方法立即呈现一个视图控制器(如果您想,还可以使用自定义转换)。

ExampleViewController *exampleController = [[ExampleViewController alloc] init];

exampleController.transitioningDelegate = self.transitioningDelegate;

[FCOverlay presentOverlayWithViewController:exampleController
                                windowLevel:UIWindowLevelNormal
                                   animated:YES
                                 completion:nil];

如果您想一次呈现一个视图控制器,您也可以使用 queueOverlayWithViewController 类方法。

AlertViewController *alertController = [[AlertViewController alloc] init];

alertController.alertTitleString = @"This is the first queued alert";
alertController.alertMessageString = @"After this alert will follow a new alert, alertception style!";
alertController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

 // queue the first alert (this will be presented immediately)
[FCOverlay queueOverlayWithViewController:alertController
                              windowLevel:UIWindowLevelAlert
                                 animated:NO
                               completion:nil];

// queue the second alert
alertController = [[AlertViewController alloc] init];

alertController.alertTitleString = @"This is the second queued alert";
alertController.alertMessageString = @"After this alert there will be no more alerts in the queue!";
alertController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

[FCOverlay queueOverlayWithViewController:alertController
                              windowLevel:UIWindowLevelAlert
                                 animated:NO
                               completion:nil];