简体   繁体   中英

IOS - dim parent view when add a color picker subview

[Picker color view][1]

I would like to make a view (like the one in screenshot below). When the picker view shows up, the screen behind is faded just like the photo. Thank for your help!!

I believe it's not hard to achieve this.

First, create a UIView called ColorPickerView and add some buttons with custom image to it(in your example, circles with different color).Then add the Cancel button so the user can remove(using removeFromSuperView) ColorPickerView by tapping it. Finally, add a UILabel to represent the title of ColorPickerView .

When the ColorPickerView show up, you should add a view on your mainPageView(Screen behind ColorPickerView ). Let's call it blurView . Set the backgroundColor of blurView to black, alpha to 0.3(your choice). Similarly, when ColorPickerView is going to be removed, you should remove the blurView also.

You can remove blurView in the action of Cancel button.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM