How to call a method a.s.a.p. but at earliest in the next run loop iteration?

后端 未结 4 1472
广开言路
广开言路 2021-02-05 10:16

I need a save way to say: \"iOS, I want this method to be executed a.s.a.p., but NOT in THIS run loop iteration. At the earliest in the next, but please not in this one. Thank y

4条回答
  •  悲哀的现实
    2021-02-05 10:43

    Quite trivial using GCD (Grand Central Dispatch):

    dispatch_async (dispatch_get_main_queue (), ^{
        NSLog (@"This stuff runs in the next iteration of the main run loop");
    });
    

提交回复
热议问题