代码中的 Alpha 更改但不是视觉上的

Alpha Changes in Code but Not Visually

当我运行:

[darkBackgroundView setAlpha:(point.y - self.view.bounds.size.height) / -5];

NSLog(@"The Alpha Is: %f", darkBackgroundView.alpha);

我在控制台中更改了 alpha,但屏幕上的视图不会更改。是的,它已连接等

为什么日志会出现:Alpha是:47.400002,但实际视图还是100.00?

谢谢!

嗯,从一个UIView

的文档

The value of this property is a floating-point number in the range 0.0 to 1.0, where 0.0 represents totally transparent and 1.0 represents totally opaque. This value affects only the current view and does not affect any of its embedded subviews.

值从 0.0 到 1.0,而不是 0.0 到 100.0