के रूप में कैसे आप किसी अन्य विधि के लिए एक पैरामीटर के रूप में एक विधि पारित करते हैं? मैं कक्षाओं में यह कर रहा हूँ।ऑब्जेक्टिव-सी गुजर तरीकों पैरामीटर
क्लास ए:
+ (void)theBigFunction:(?)func{
// run the func here
}
कक्षा बी:
- (void)littleBFunction {
NSLog(@"classB little function");
}
// somewhere else in the class
[ClassA theBigFunction:littleBFunction]
कक्षा सी:
- (void)littleCFunction {
NSLog(@"classC little function");
}
// somewhere else in the class
[ClassA theBigFunction:littleCFunction]
आप चयनकर्ता पास करते हैं एस, यहां एक समान प्रश्न है: http://stackoverflow.com/questions/519600/is-it-possible-to-pass-a-method-as-an-argument-in-objective-c – utahwithak