Why only one delegate?

I read that an object can only have one delegate at a time. But is this really so?

Let's say I create an object with a protocol, and from this object I want to collect a lot of data from several other objects. I add every object that matches my protocol to the array. Then I just go through it and call my methods for each delegate.

NSMutableArray *collectFromDelegates = [NSMutableArray alloc]init];

//in delegateArray I keep pointers to every delegate.
for(id delegate in delegateArray){
  [collectFromDelegates addObject:[delegate someProtocolMethod]];
}

It is not right?

+3
source share
7 answers

This is not really delegation .

- , . - - . , .

, , . , , , , , , - .

. , , , , , , , , .

, , . , , , . .

+9

Apple "". , , . - .

"dataSources".

+1

- - , . .

Apple source delegate. Source ivars ( ) , -ivars . , ?

NSNotification .

, !

+1

, , . . , , , , -. .

, , , , , . , . IOS SDK . Observer.

...

+1

, . ?

? , . , UITableView , , - .

+1

, , , , NSNotification s. , object . , .

0

, , , .

0
source

All Articles