我今天第一次使用
@selector
,但是我还没有想出如何完成以下操作。如果有多个参数,您会如何编写@selector
?
没有参数:
没有参数:
-(void)printText {
NSLog(@"Fish");
}
[self performSelector:@selector(printText) withObject:nil afterDelay:0.25];
单个参数:
-(void)printText:(NSString *)myText {
NSLog(@"Text = %@", myText);
}
[self performSelector:@selector(printText:) withObject:@"Cake" afterDelay:0.25];
两个参数:
-(void)printText:(NSString *)myText andMore:(NSString *)extraText {
NSLog(@"Text = %@ and %@", myText, extraText);
}
[self performSelector:@selector(printText:andMore:) withObject:@"Cake" withObject:@"Chips"];
多参数:(即超过2个)