ios - 我如何模糊我的 UIViewController 上的一些层(不是代码,只是概念)

标签 ios uiviewcontroller

我今天在使用 AirBnB 应用程序,我非常喜欢他们登录时的用户体验。

他们有一个正常的登录 View ,当您点击“提交”或其他任何启动身份验证过程时,他们会在上面放一个黑色层,半不透明,并且有一个旋转的动画。

描述这个的技术术语是什么?

他们可能使用的元素是什么?我想自己尝试一下,但我只是在研发,所以我不会花时间做硬核低级图形。只是一个快速 n 肮脏的概念。

有什么建议吗?

最佳答案

Apple 现在为 UIImage 提供了一个名为 UIImage+ImageEffects 的类别,可以加快这些技巧。然后您只需调用其中一种方法来应用效果。然而,在调用之前缩小图像分辨率总是好的,因为它需要一些时间来计算。

  • (UIImage *)applyLightEffect;
  • (UIImage *)applyExtraLightEffect;
  • (UIImage *)applyDarkEffect;
  • (UIImage *)applyTintEffectWithColor:(UIColor *)tintColor;

https://github.com/codeschool/UIImage-ImageEffects

https://github.com/iGriever/TWSReleaseNotesView/blob/master/TWSReleaseNotesView/UIImage%2BImageEffects.h

拍摄屏幕上显示的图像:

UIGraphicsBeginImageContextWithOptions(self.imageView.bounds.size, self.imageView.opaque, 0.0);
[self.imageView.layer renderInContext:UIGraphicsGetCurrentContext()];

UIImage *img = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

UIImage *blurredImage = [img applyDarkEffect];

Apple 的 session :WWDC 2013 Session 226: Implementing Engaging UI on iOS , PDF 的第 40 页或视频的 15:00 左右。他们在那里进行了详细解释。

关于ios - 我如何模糊我的 UIViewController 上的一些层(不是代码,只是概念),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21675583/

相关文章:

ios - 在Swift中,如何从UITableView中获取对象id并根据对象id删除对象?

ios - 向下滚动以逐渐隐藏菜单栏或查看并向上滚动

objective-c - didRotateFromInterfaceOrientation : is not called for controller which presented modal controller on iOS 5

ios - 使用 WL.NativePage.Show 过程的 native 页面呈现错误

ios - 访问 Assets.xcassets 中的所有图像 ?? [ swift 3 ]

ios - 执行自定义 View Controller 时出现问题关闭动画

iphone - 可以从 OS 3.2 中的 UIImagePickerController 中删除“取消”按钮吗?

iphone - 如何让音频播放器再次播放?

ios - 通过 NSDate 对象属性快速过滤

ios - 我可以从我自己的应用程序创建提醒/警报类型的通知吗?