开发者

(iphone) is it safe to access UIView's data member from background thread?

开发者 https://www.devze.com 2023-02-23 22:07 出处:网络
I know that you can\'t update UIView from background view. But not sure if that rule applies when I\'m o开发者_运维技巧nly accessing custom data member variable of UIView descendants.

I know that you can't update UIView from background view.

But not sure if that rule applies when I'm o开发者_运维技巧nly accessing custom data member variable of UIView descendants.

Suppose I have

@interface MyView : UIView
{ 
NSNumber* number;
}

@property (retain) NSNumber* number;

Here, does accessing the "number" variable from background thread violate the rule "no UIView update from background thread" ?

Thank you


Accessing your subclasses properties in a background thread shouldn't cause any problems if they are marked as atomic (the default). You have to make sure that you don't call any UIView methods that cause drawing though.

0

精彩评论

暂无评论...
验证码 换一张
取 消