gpt4 book ai didi

ios - setNeedsDisplay 是立即生效还是仅在稍后排队?

转载 作者:可可西里 更新时间:2023-11-01 05:42:32 24 4
gpt4 key购买 nike

这里有人知道 setNeedsDisplay 是否会立即调用 drawRect 并立即更新屏幕吗?或者它只是一个排队的请求?谢谢。

最佳答案

View 直到下一个绘图周期才真正重绘。这只是通知系统应该重绘 View 。

参见 UIView Class Reference

您显然可以通过将内容模式设置为 UIViewContentModeRedraw 来完成此操作。我个人没有这样做过,但代码应该是这样的

UIView *redrawView = [[UIView alloc] initWithFrame:frame];
...
redrawView.contentMode = UIViewContentModeRedraw;

参见 View and Window Modes: Content Modes

关于ios - setNeedsDisplay 是立即生效还是仅在稍后排队?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7177281/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com