Take the 2-minute tour ×

I have a tab-based application with a number of navigation controllers in the tabs. Each view can (potentially) have need for data that I manage using a singleton class.

The singleton class downloads data asynchronously and my problem is: How should I notify the active view (or all views?) that the data has completed.

In the Java world, the views would register themselves as listeners on the singleton, but that does not seem very objective-c-ish.

Please note that I do have solutions to this, none very pretty, and I want to do this the correct way (part of the objective here is to find good patterns for various things).

Basically, I want to broadcast "Hey, I'm done" to either the active view, a view that registers itself as active using "my" api, or all views. Without having to keep track of the views from the singleton.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

There is method [NSObject performSelectorOnMainThread:], that's for one view. Or, you can use NSNotificationCenter.

share|improve this answer
He will more than likely use a combination of [NSObject performSelectorOnMainThread:] and posting a notification. –  Joe Jan 14 '11 at 22:06
The NSNotificationCenter class looks very promising. I overlooked that before. I will look into using that. Thanks! –  Krumelur Jan 14 '11 at 22:09
That solved my problem perfectly. Just what I was looking for, thanks –  Krumelur Jan 14 '11 at 22:16

Your Answer


