测试测试 | ✗ |
Lang语言 | Obj-CObjective C |
许可证 | MIT |
发布上次发布 | 2014年12月 |
由Matt Hupman维护。
依赖 | |
UIImage+BlurredFrame | ~> 0.0.4 |
MZAppearance | ~> 1.1.1 |
BlurryModalSegue 是 UIStoryboardSegue 子类,为模态故事板 segue 提供模糊效果。它提供了透明模态覆盖层的外观和感觉,而不会偏离苹果提供的模态呈现模型。
通过 Cocoapods
pod 'BlurryModalSegue'
将模态故事板 segue 从这个改为这个
好了!
!
如果嵌套视图控制器正在显示(例如,UINavigationController -> UIViewController),请确保将嵌套视图的背景色设置为 [UIColor clearColor],以便模糊的 UIImageView 可见
BlurryModalSegue 符合 UIAppearance 协议。在整个应用程序中配置一次
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[BlurryModalSegue appearance] setBackingImageBlurRadius:@(20)];
[[BlurryModalSegue appearance] setBackingImageSaturationDeltaFactor:@(.45)];
return YES;
}
此外,您可以在呈现前自定义实例,只需实现 prepareForSegue:sender:
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue isKindOfClass:[BlurryModalSegue class]])
{
BlurryModalSegue* bms = (BlurryModalSegue*)segue;
bms.backingImageBlurRadius = @(20);
bms.backingImageSaturationDeltaFactor = @(.45);
bms.backingImageTintColor = [[UIColor greenColor] colorWithAlphaComponent:.1];
}
}
如果在执行转换后看不到模糊的背景而只是一个实色,请确保要显示的视图控制器没有为其视图设置背景色。这通常发生在显示一个正在显示根视图控制器的 UINavigationController 时。包含模糊图片的 UIImageView 被添加为 -[UIStoryboardSegue destinationViewController]
的 view
属性的子视图。在所显示的 UINavigationController 的情况下,它立即显示一个子视图控制器。如果该视图控制器具有实色背景,它可能会完全隐藏模糊的 UIImageView。
UIViewControllerTransitionCoordinator
。UIModalTransitionStylePartialCurl
不受支持,实际上对这个库也不太合适。UIModalTransitionStyleCoverVertical
,细心的开发者会注意到,在显示期间比在消失期间效果更好。这是因为在 [UIViewController -transitionCoordinator]
中,似乎只支持显示,而不是消失。我相信可以通过 [UIViewController -transitioningDelegate]
实现消失,但这还有待确定。