我如何重新加载(或)刷新 uiview?

发布于 2024-09-24 06:08:17 字数 589 浏览 1 评论 0原文

嗨,

我对 iPhone 开发非常陌生。我正在该应用程序中做一个应用程序,该应用程序有多个 uiview。一个 uiview 具有 uislider 和 uilabel。uislider 用于显示歌曲计时,uilabel 用于显示歌曲计数.虽然计时器显示(-0.00),即滑块到达末尾,下一首歌曲已正确播放,但是,uilabel 不显示下一首歌曲的计数,它始终只显示 (1 0f 5)...另一个 uiview 名为v_lyrics 而下一首歌曲播放歌词视图也没有更新...我认为唯一的问题是视图和标签没有正确刷新...

代码: 使用此代码进行标签刷新:

[label setNeedsDisplay];
[label performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:YES];

用于视图刷新的代码:

[v_lyrics setNeedsDisplay];

请告诉我如何刷新 uilabel 和 uiview...我应该在哪里提供此代码...

谢谢... 仁亚

HI,

I'm very new to iphone development.I'm doing one application in that app having more than one uiview.one uiview having uislider and uilabel.uislider is used to show the song timings and uilabel is used to shows the song count.while the timer shows(-0.00)that is the slider reach the end next song is correctly played but,the uilabel not showing the count of next song always it shows the (1 0f 5)only...and another uiview named as v_lyrics while the next song playing lyrics view also not updating...I think the only problem in this is view and label not properly refreshing...

code:
use this code for label refreshing:

[label setNeedsDisplay];
[label performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:YES];

code for view refreshing:

[v_lyrics setNeedsDisplay];

plz tel me how can i refresh both uilabel and uiview...where should i give this code...

Thank you...
Renya

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

临走之时 2024-10-01 06:08:17

简而言之,setNeedsDisplay 调用 UIView 中的drawRect 方法。从你的解释来看,我怀疑这就是你的问题所在。我注意到你正在线程化你的操作,更新你的 UI 只能在主线程上完成。也许这就是你的问题所在。

setNeedsDisplay in a nut shell calls the drawRect method in UIView. I doubt from your explanation this is where your problem lies. I notice that you are threading your operations, updating your UI can only be done on the main thread. Perhaps thats where your problem lies.

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