外观代理重新加载视图

发布于 2024-12-13 19:06:09 字数 253 浏览 0 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

但可醉心 2024-12-20 19:06:09

我很快就把它修好了。

我只是从全屏模式视图开始,在更改主题后,我关闭该视图,因此其背后的视图将被更新。

如果有人有更好的解决方案,我真的很想听听。

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.

反目相谮 2024-12-20 19:06:09

[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:

暖伴 2024-12-20 19:06:09

我在更改 UISliders 的外观时遇到了或多或少相同的问题。使用 [self.view setNeedsDisplay] 没有效果。

使用下面的代码行,滑块的外观没有按预期更改,但只有在加载和关闭另一个视图之后才会更改。

[[UISlider appearance] setMinimumTrackTintColor:[UIColor greenColor]]; 

为每个滑块创建 IBOutlet 并按如下设置着色颜色达到了预期的效果,并且更改立即发生。

[volumeSlider setMinimumTrackTintColor:[UIColor greenColor]];
[brightnessSlider setMinimumTrackTintColor:[UIColor greenColor]];

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.

[[UISlider appearance] setMinimumTrackTintColor:[UIColor greenColor]]; 

Creating IBOutlets for each slider and setting tintcolor as below had the desired effect and changes took place immediately.

[volumeSlider setMinimumTrackTintColor:[UIColor greenColor]];
[brightnessSlider setMinimumTrackTintColor:[UIColor greenColor]];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文