如何在方法中强制视图多次重绘自身?
我有一个 UIImageView ,我想根据用户输入更改其图像。例如,用户单击按钮,然后背景图像被替换为另一图像。程序会阻塞一两秒,然后用新图像替换原始图像。问题是,在方法返回之前视图似乎不会重新绘制自身,因此中间的 UIImage 永远不会显示。
如何重写此行为以使 UIImageView (或视图本身)在方法中间重绘自身?
I have a UIImageView whose image I want to change depending on user input. For example, the user clicks a button, after which the background image is swapped out for another image. The program blocks for a second or two, and then the new image is swapped out for the original image. The problem is, it seems that the view doesn't redraw itself until the method has returned, so that the middle UIImage is never displayed.
How can I override this behavior to get the UIImageView (or the view itself) to redraw itself in the middle of a method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当用户单击时,启动 NSTimer :
它不应该阻止您的程序。
When user click, start a NSTimer :
It should not block your program.