Reputation: 3071
@protocol msgRcvdFrom <NSObject>
@optional
-(void) msg:(NSString *)msg from:(NSString *)from;
.
.
.
if([delegate respondsToSelector:@selector(msg:from:)])
{
[delegate msg:body from:user];
}
this is my delegate and two different classes are using it, when respondsToSelector is called will both classes will be notified? or if I want to notify one class at a time. Please clear this confusion.
Upvotes: 1
Views: 56
Reputation: 1848
delegate
usually is an object (declared as id< msgRcvdFrom>
).
So.. when you call respondToSelector
on delegate
you are asking to that particular object if it has the method or not!
Upvotes: 2