ASDepthModal 主要受到 http://lab.hakim.se/avgrund/ 中的一些优秀 CSS 作品的启发。
它使得当前的全屏视图与推送背景的模糊效果和出现在前面的模态弹出视图之间有深度感。
支持 iOS 5 和 6。
模糊效果是从 https://github.com/rnystrom/RNBlurModalView 复制的代码。
下载整个项目,并在 Xcode 中运行。你可以选择 iPhone 或 iPad 作为目标。它支持所有方向变化。
只需将 ASDepthModalViewController.h, ASDepthModalViewController.m, UIImage+Blur.h 和 UIImage+Blur.m 复制到你的项目,并在你需要的位置导入 #import "ASDepthModalViewController.h"
。
一旦你有弹出视图,这里是显示它的方式
[ASDepthModalViewController presentView:yourPopupView];
一旦你在外部点击弹出视图,弹出视图就会自动关闭。
如果你需要通过代码关闭弹出视图(通常你有“关闭”按钮用于此目的)
[ASDepthModalViewController dismiss];
你可以配置背景颜色,以及不同的选项
[ASDepthModalViewController presentView:yourPopupView
backgroundColor:color
options:options
completionHandler:handler];
有三种样式可供选择:无效果、增长效果或收缩效果。
此类需要 ARC。