如何调暗父级UIView(50%透明)进行登录? [英] How to dim a parent UIView (50% transparent) for login?

查看:65
本文介绍了如何调暗父级UIView(50%透明)进行登录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有登录按钮的视图。单击该按钮后,我将添加一个带有用于登录的字段的视图。发生这种情况时,我需要使父视图变暗。我该怎么做?

I have a view with a Login button. When the button is clicked, I add a view with fields for login. When this happens, I need to dim the parent view. How I do that?

推荐答案

在父视图上添加一个UIView,该UIView最初是透明的,背景色为黑色。当您需要将其变暗时,将视图的Alpha更改为0.5。这将是50%透明的。

Add a UIView over the parent view that is initially transparent with a background color of black. When you need to dim it, change the view's alpha to 0.5. This will be 50% transparent.

这篇关于如何调暗父级UIView(50%透明)进行登录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆