我有一个应用程序,例如 iOS 10 map 应用程序或带有控制中心的主屏幕。例如,看一下图片。如果打开控制中心,背景的阴影将变为黑色和透明。我如何访问该图层或 subview 并将颜色从该阴影更改为我的应用程序中的另一个。也许是红色或白色?
编辑:
也许直接使用框架。 https://github.com/iosphere/ISHPullUp
最佳答案
您可以像这样使用UIVisualEffectView: Obj-C:
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];//SELECT STYLE OF YOUR CHOICE
UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
blurEffectView.frame = self.view.bounds;//view Will be YOUR_VIEW
blurEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:blurEffectView];//This add Blur view to your view
swift :
let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.dark)
let blurEffectView = UIVisualEffectView(effect: blurEffect)
blurEffectView.frame = self.view.bounds
blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.view.addSubview(blurEffectView)
关于ios - 更改背景中阴影的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38563894/