How to pass the value to the function when clicking on the UIButton

来源:互联网 发布:云计算的架构和类型 编辑:程序博客网 时间:2024/05/01 16:11
苹果开始时,当点击一个按钮,跳转到下一下页面,点击时,传递一个参数到调用方法
下面是老外的解释:
 
 
Hi all,

NSString *name = @"John";

I need to pass the above variable value, when clicking on the uibutton

currently i created the uibutton like below

sendButton = [[UIButton alloc] initWithFrame:CGRectMake(170, 350, 90, 30)];

[sendButton setTitle:@"YES!" forState:UIControlStateNormal];

[sendButton addTarget:self action:@selector(sendAlert forControlEvents:UIControlEventTouchUpInside];

[sendButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

sendButton.backgroundColor = [UIColor whiteColor];

[popoverView addSubview:sendButton];

[sendButton release];

when i clicking the above button, it calls the method but i want to pass the variable (name) to the function...

Please guide me to get it ....
原创粉丝点击