Nicholas
Nicholas

Reputation: 149

Alpha Changes in Code but Not Visually

When I run:

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

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

I get the alpha changing in the console, but the view will not change on the screen. Yes it is hooked up etc.

Any reasons why the log would produce: The Alpha Is: 47.400002, but the actual view is still 100.00?

Thanks!

Upvotes: 1

Views: 14

Answers (1)

Louis T
Louis T

Reputation: 1313

Well, from the documentation of a 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.

Value from 0.0 to 1.0, not 0.0 to 100.0

Upvotes: 2

Related Questions