ios - how to pass data when button is clicked -
lets have 10 buttons. each button want pass text... e.g. button 1, new button 2, etc....
what want print text in nslog.
hence created 1 method , passed button. not getting how can pass data it...
[mybutton addtarget:self action:@selector(btnselected:) forcontrolevents:uicontroleventtouchupinside]; -(ibaction)btnselected:(id)sender { nslog(@"btnselected data %@", sender); // want print text respective button here... }
but not getting... idea how done?
try this,
[mybutton setaccessibilityvalue:@"some text"]; [mybutton addtarget:self action:@selector(btnselected:) forcontrolevents:uicontroleventtouchupinside]; -(ibaction)btnselected:(id)sender { nslog(@"btnselected data %@", [sender accessibilityvalue];); // want print text respective button here... }
Comments
Post a Comment