setNeedsDisplay:True 除非激活否则不会重绘?
我有一个自定义视图,它是主窗口的子视图。我有一个计时器,它会触发 [self setNeedsDisplay:TRUE] ,它将更新视图上的绘图。但据我所知,如果我将应用程序留在后台并切换到另一个应用程序,它不会反映新的绘图功能,直到我再次单击该应用程序。 我可能会错过什么? 谢谢你, 何塞.
I have a custom view that is a subview of the main window. I have a timer that fires a [self setNeedsDisplay:TRUE] that will update drawing on the view. But from what I can see, if I leave the application on the background and switch to another, it does not reflect the new drawing functions until I click again on the application.
What could I be missing?
Thank you,
Jose.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果
setNeedsDisplay
认为用户出于明显原因看不到其绘制的内容,则不会触发。这包括屏幕外和模糊的视图,即使应用程序正在运行也是如此。在您可能会随着时间的推移绘制数据的应用程序中,您将在应用程序恢复时立即在后台绘制所有相关数据。
setNeedsDisplay
will not fire if it thinks the user cant see what its drawing for obvious reason. This includes, offscreen and obscured views even when the app is running.In an app where you might be drawing data over time you would draw all the relevant data while backgrounded out at once when the app resumes.