简体   繁体   English

按下时UIButton闪烁

[英]UIButton flickers when pressed

I have several UIButtons in my app with different graphics for their On/Off states. 我的应用程序中有几个UIButton,它们的On / Off状态有不同的图形。 The smaller buttons all display correctly without any flickering, but the larger button (320x90px) will flicker a black color over the button when pressed up to 75% of the time. 较小的按钮全部显示正确,没有任何闪烁,但较大的按钮(320x90px)在按下75%的时间时会在按钮上闪烁黑色。 This is on the iPhone, not the Simulator. 这是在iPhone上,而不是模拟器。 I've set different combinations of the UIButton's Default,Highlighted,Selected,and Disabled state images in IB but I still cannot get rid of this flicker. 我在IB中设置了UIButton的默认,突出显示,选定和禁用状态图像的不同组合,但我仍然无法摆脱这种闪烁。 Is there something else I can try? 我还能尝试别的吗?

If you are doing something like button.selected = !button.selected in your handler, then I had this problem as well. 如果您在处理程序中执行了类似button.selected = !button.selected的操作,那么我也遇到了这个问题。 I fixed it calling button.highlighted = NO . 我修了它调用button.highlighted = NO

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM