確定不使用NSInvocation
,讓我們說我有這樣的代碼:語法@selector的
...
array = [NSMutableArray arrayWithObjects:@"Yoda", @"Jedi", @"Darth Vader", @"Darth Vader", @"Darth Vader" , @"Darth Vader", nil];
SEL removeObjectMessage = @selector(removeObject:inRange:);
//does array allow us to remove and object in a range? if so let's do this
if ([array respondsToSelector:removeObjectMessage]){
NSRange darthVaderRange=NSMakeRange(2, 3);
[array removeObject:@"Darth Vader"inRange:darthVaderRange];
}
我怎麼會在SEL removeObjectMessage的形式執行最後一行?我將不得不圍繞範圍包裝?我只想看看所有這些亂七八糟的語法......
HM。好的...我想我只需要了解更多關於NSInvocation的知識。我可能也是,因爲我已經深入到SEL了...... –