Top "Objective-c-blocks" questions

Blocks are Apple’s implementation of closures for C, which are also available for Objective-C and C++.

How to store blocks in properties in Objective-C?

I'd like to store objective-c block in a property for later use. I wasn't sure how to do it so …

objective-c objective-c-blocks
Blocks instead of performSelector:withObject:afterDelay:

I often want to execute some code a few microseconds in the future. Right now, I solve it like this: …

iphone objective-c cocoa-touch ios objective-c-blocks
Using weak self in dispatch_async function

I read a lot of posts about using __weak self inside dispatch_async, and now I am a litle bit …

ios objective-c-blocks weak-references retain-cycle
UIButton block equivalent to addTarget:action:forControlEvents: method?

I looked around, but couldn't find this on the internet, nor anywhere in the Apple docs, so I'm guessing it …

iphone uibutton objective-c-blocks
Reloading a UICollectionView using reloadData method returns immediately before reloading data

I need to know when reloading a UICollectionView has completed in order to configure cells afterwards (because I am not …

objective-c-blocks uicollectionview uicollectionviewcell completionhandler
Block implicitly retains 'self'; explicitly mention 'self' to indicate this is intended behavior

Given the following: - (void) someMethod { dispatch_async(dispatch_get_main_queue(), ^{ myTimer = [NSTimer scheduledTimerWithTimeInterval: 60 target: self selector: @selector(doSomething) …

objective-c macos objective-c-blocks
How does a completion handler work on iOS?

Im trying to understand completion handlers & blocks. I believe you can use blocks for many deep programming things without …

ios objective-c-blocks completionhandler
Why can't we use a dispatch_sync on the current queue?

I ran into a scenario where I had a delegate callback which could occur on either the main thread or …

objective-c multithreading objective-c-blocks grand-central-dispatch
How does typedef-ing a block works

In C/Obj-C, we do a typedef like this typedef int MYINT; which is clear. Doing typedef for a block …

objective-c objective-c-blocks typedef