外观代理重新加载视图
在 iPad 中,您可以在模态推送的视图中更改应用程序的外观。但选择主题并关闭视图后,外观不会改变。如果我全屏推送另一个视图,该视图就会更新。
如何强制更新/刷新/重新绘制外观?
编辑
我尝试在任何地方播放setNeedsDisplay,但应用程序没有直接响应。 正如参考文献所述,一旦循环重新启动,视图就会被标记为重新绘制。
并且由于该视图已经在模态推送的外观更改器视图后面加载了其他外观,因此不会重新加载。
In the iPad you can change the appearance of the app in a view which is modally pushed. But after selecting a theme and dismissing the view the appearance does not change. if I push an other view full-screen, the view is updated.
How can I force to update/refresh/repaint the appearance?
EDIT
I tried playing setNeedsDisplay everywhere, but the app does not respond directly.
As the reference said, the view is marked to be redrawn as soon as the loop restarts.
And because the view is already loaded with an other appearance behind the modally pushed appearance changer view, it is not reloaded.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我很快就把它修好了。
我只是从全屏模式视图开始,在更改主题后,我关闭该视图,因此其背后的视图将被更新。
如果有人有更好的解决方案,我真的很想听听。
I quick-fixed it.
I just start with a full-screen modal view and after I changed the theme I dismiss the view, so the views behind it will be updated.
If some one has a better solution I really like to hear about it.
[view setNeedsDisplay]
通常用于告诉视图需要重绘。[view setNeedsLayout]
与-layoutSubviews
相同请参阅:
[view setNeedsDisplay]
is typically used to tell the view it needs to be redrawn.[view setNeedsLayout]
is the same for-layoutSubviews
See:
我在更改 UISliders 的外观时遇到了或多或少相同的问题。使用
[self.view setNeedsDisplay]
没有效果。使用下面的代码行,滑块的外观没有按预期更改,但只有在加载和关闭另一个视图之后才会更改。
为每个滑块创建 IBOutlet 并按如下设置着色颜色达到了预期的效果,并且更改立即发生。
I had more or less the same issue changing the appearance of UISliders. Using
[self.view setNeedsDisplay]
had no effect.With the line of code below the appearance of the sliders did not change as expected, but only afterwards if another view were loaded and dismissed.
Creating IBOutlets for each slider and setting tintcolor as below had the desired effect and changes took place immediately.