UISlider alpha 问题
我想弄清楚这样一个问题:
我有一个 UIView 派生类,其中有多个控件。 其中一些必须根据所选模式出现和消失。 这是通过将 aplha 值设置为相关组件来实现的。
所有控件都以正常方式通过 initWithFrame 中的代码按程序添加。 所有控件均按预期工作,但 UISlider 除外! 在 initWithFrame 中将其初始 alpha 设置为 0.0f 没有任何效果。 这特别奇怪,因为在代码中进一步设置其 alpha 工作正常。 该组件已经存在,并且 NSLog 显示它的地址并正确设置了 alpha。 但真正的 alpha 是 1.0f!
如果我将 UISlider 替换为任意其他视图,它可以正常工作。 为什么?
我的猜测 - 这是因为内部动画过程会干扰创建时的 alpha 值。
我使用的唯一解决方法 - 将滑块放置在虚拟视图上并设置其透明度。
有人知道另一种解决方案吗?
I'm want to figure out such an issue:
I have a UIView dervied class in which there are several controls. Some of them must appear and disappear depending on selected mode. This is made by means of setting aplha value to respected component.
All controls adds procedurally through code in initWithFrame in normal way. All controls works as expected but UISlider! Setting its initial alpha to 0.0f in initWithFrame have no effect. This is especially strange because futher setting of its alpha in code works OK. This component already exists and NSLog displays it's address and setted alpha correctly. But real alpha is 1.0f!
If I replace UISlider to arbitrary other view its works properly. Why?
My guess - this is because of internal animation processes which is interfere alpha value upon creation.
The only workaround I use - to place slider on dummy view and set it's transparency.
Does anybody knows another solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)