开发者

iphone - update UI always on Main Thread?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜