Get text of button from IBAction - iPhone
Posted
by Organiccat
on Stack Overflow
See other posts from Stack Overflow
or by Organiccat
Published on 2009-05-20T15:35:08Z
Indexed on
2010/03/12
1:47 UTC
Read the original article
Hit count: 439
When an IBAction is called:
-(IBAction) onClick1: (id) sender;
What is passed in the sender? Since it's hooked up through the IB, I'm not really sure. My question is how to get the text of the button to be the passed object (NSString most likely) so that I could call it inside the action implementation.
-(IBAction) onClick1: (id) sender {
NSLog(@"User clicked %@", sender);
// Do something here with the variable 'sender'
}
© Stack Overflow or respective owner