1
ok donc je veux faire une fonction publique qui retournera OUI si un objet existe, se conforme à un protocole et répond à un sélecteur. Je sais que le typedef de @selector est SEL, mais ce qui est le typedef pour @protocoliPhone SDK @selector -> SEL @protocol ->?
BOOL conforms(id object, ? prototype, SEL action) { return (object != nil && [object conformsToProtocol:prototype] && [object respondsToSelector:action]); }
Et je veux être en mesure d'appeler cette fonction comme:
if(conforms(delegate, @protocol(UIScrollViewDelegate), @selector(touchesBegan:withEvent:))) { [delegate touchesBegan:touches withEvent:event]; }
vous plaisantez-vous c'était si simple? xD bahaha merci :) –