码迷,mamicode.com
首页 > 其他好文 > 详细

button点击传多个参数

时间:2015-10-21 19:05:47      阅读:190      评论:0      收藏:0      [点我收藏+]

标签:

 

// --------------------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);

}

button点击传多个参数

标签:

原文地址:http://www.cnblogs.com/xiangjune/p/4898554.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!