ARC __bridge cast Block_copy & Block_release

前端 未结 2 505
遇见更好的自我
遇见更好的自我 2021-01-14 01:43

For some reason I want a block to execute during the next iteration of the run loop, so I came up with:

typedef void (^resizer_t)() ;

- (void) applyResizer:         


        
2条回答
  •  感情败类
    2021-01-14 02:13

    I want a block to execute during the next iteration of the run loop

    Well, that's why you've got dispatch_after. If you supply a tiny time value, it will have exactly the effect you're after: you give a block, and the block will execute as soon the current runloop finishes and the redraw moment has happened.

    Or if you can live without insisting on a block, use performSelector:withObject:afterDelay: with a tiny delay value (even zero). That has the same effect.

    What you're asking for is called "delayed performance" and is very common. So do it the common way, the way the framework gives you; don't try to get all weird and fancy like your code is doing.

提交回复
热议问题