【发布时间】:2012-07-07 15:18:09
【问题描述】:
我正在尝试创建一个 UIView 并更改其 alpha 属性以模拟背光变化。 这是我的代码
TransparentView = [[UIView alloc] initWithFrame:self.view.bounds];
TransparentView.backgroundColor = [UIColor whiteColor];
self.view = TransparentView;
TransparentView.alpha = 0.2;
float step = 1.0 / ( appDelegate.OnOffTime * 100);
for (float f = 0; f < 1; f=f+step) {
TransparentView.alpha = (CGFloat)(1 - f);
[NSThread sleepForTimeInterval:0.01];
}
TransparentView.alpha = 0.2 和 TransparentView.alpha = (CGFloat)(1 - f) 都改变了TransparentView.alpha,但只有TransparentView.alpha = 0.2 改变了真实设备的“亮度”。
我做错了什么?
【问题讨论】:
标签: objective-c ios ios5 uiview