Objective-C передача методов в качестве параметров

Как передать один метод в качестве параметра другому методу? Я делаю это в разных классах.

Класс A:

+ (void)theBigFunction:(?)func{
    // run the func here
}

Класс B:

- (void)littleBFunction {
    NSLog(@"classB little function");
}

// somewhere else in the class
[ClassA theBigFunction:littleBFunction]

Класс C:

- (void)littleCFunction {
    NSLog(@"classC little function");
}

// somewhere else in the class
[ClassA theBigFunction:littleCFunction]
28
задан bryanmac 9 November 2012 в 12:12
поделиться

0 ответов