开发者

iphone - update UI always on Main Thread?

开发者 https://www.devze.com 2023-01-24 14:02 出处:网络
I know Apple said all UI-related operations should be carried out on main thread. So my question is \"all UI-related operations\" really mean every possible UI-related operaton?

I know Apple said all UI-related operations should be carried out on main thread.

So my question is "all UI-related operations" really mean every possible UI-related operaton?

For exampl开发者_运维技巧e, I will addSubview ViewB to ViewA in a separate thread. Should I always use [ViewA performSelectorOnMaintThread:@selector(addSubview:)...... on the separate thread?

thanks


Yes, You should deal with all about UI in the main-thread. If you are under MFC, you should be in the same manner.


Grand Central Dispatch does things in background threads (for example this line: dispatch_async(dispatch_get_main_queue(), myBlock);) and no crash at all. And i do a lot of things on myBlock()


Yes.

It will crash otherwise.

0

精彩评论

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