标签:
// --------------------button点击传多个参数------------------------
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
btn.frame = CGRectMake(100, 100, 200, 50);
btn.backgroundColor = [UIColor blueColor];
[btn setTitle:@"click me" forState:UIControlStateNormal];
btn.layer.borderColor = (__bridge CGColorRef)([UIColor whiteColor]);
btn.layer.borderWidth = 2;
[btn addTarget:self action:@selector(click) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
-(void)click
{
NSLog(@"click me");
[self performSelector:@selector(click:) withObject:@"test first"];
}
-(void)click:(NSString *)firstArg
{
[self performSelector:@selector(click:andSecondArg:) withObject:@"test first" withObject:@"test second..."];
}
-(void)click:(NSString *)firstArg andSecondArg:(NSString *)secondArg
{
NSLog(@"firstArg : %@,secondArg : %@", firstArg, secondArg);
}
标签:
原文地址:http://www.cnblogs.com/xiangjune/p/4898554.html