UIView的不透明度和alpha是否相同 [英] Is the opacity and alpha the same thing for UIView

查看:212
本文介绍了UIView的不透明度和alpha是否相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用动画来改变UIView的颜色以使其淡化,但是,不知怎的,我无法访问和设置不透明度,但我可以设置alpha。我想知道alpha和不透明度是否相同?在网上搜索,我没有找到一个好的答案。非常感谢您的帮助!

I want to use animation to change UIView's color to make it fade, however, somehow i can't access and set opacity, but i can set alpha. I wonder if alpha and opacity are the same? Search on the web and I didnt find a good answer. Thanks a lot for your help!

推荐答案

实际上不透明度是指<$ c $的alpha-channel值 C>的UIView 。当视图完全不透明时,这意味着它的 alpha = 1 ,当视图完全透明(非不透明)时,其 alpha = 0

Actually "opacity" means "value of alpha-channel" of your UIView. When a view is fully opaque this means its alpha = 1, when a view is fully transparent (non-opaque) its alpha = 0.

关于 CALayer UIView 在Cocoa中,是的,它们提供相同的功能。

As about properties of CALayer and UIView in Cocoa, yes, they provide the same functionality.

这篇关于UIView的不透明度和alpha是否相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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