[英]IOS - dim parent view when add a color picker subview
[选择器颜色视图][1]
我想做一个视图(就像下面截图中的那个)。 When the picker view shows up, the screen behind is faded just like the photo. 感谢您的帮助!!
我相信实现这一目标并不难。
首先,创建一个名为ColorPickerView
的 UIView 并向其添加一些带有自定义图像的按钮(在您的示例中,具有不同颜色的圆圈)。然后添加Cancel
按钮,以便用户可以通过点击它来删除(使用 removeFromSuperView) ColorPickerView
。 最后,添加一个 UILabel 来表示ColorPickerView
的标题。
当ColorPickerView
出现时,您应该在 mainPageView( ColorPickerView
后面的屏幕)上添加一个视图。 我们称之为blurView
。 将blurView
的 backgroundColor 设置为黑色,将 alpha 设置为 0.3(您的选择)。 同样,当要删除ColorPickerView
时,您也应该删除blurView
。
您可以在Cancel
按钮的操作中删除blurView
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.