Sunday 15 February 2015

ios - Xcode: Send value through target action from for loop -



ios - Xcode: Send value through target action from for loop -

i've got list of values coming database, each has it's own unique id. want able delete row list using id. issue is, i'm trying understand how send value through button action used in called function.

for ex:

nsstring *sid = [_idarray objectatindex:i]; _fid = [sid intvalue]; [deletebtn addtarget:self action:@selector(deletefeed:_fid) forcontrolevents:uicontroleventtouchupinside];

the _fid value i'm trying understand how send function deletefeed. know must simple, can't pin downwards when searching google.

addtarget has defined set of params , cannot send custom.

as workaround can below: utilize next api , set _fid tag button:

action:@selector(deletefeed:)

i.e.

[deletebtn settag:_fid] [deletebtn addtarget:self action:@selector(deletefeed:) forcontrolevents:uicontroleventtouchupinside];

now retrieve tag button associated tag identify button.

- (void) deletefeed:(uibutton*)sender{ [self deletewithtag:sender.tag]; // or place opening logic right here }

i hope helps.

ios xcode sqlite

No comments:

Post a Comment