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


I have found a list of values ​​coming from the database, each of which has its own unique identity. I want to be able to delete a line from the list. My point is, I am trying to understand how to send the value through button action used in the called function.

For pre:

  NSString * sId = [_idArray object endx: i]; _fId = [sId intValue]; [DeleteBtn addTarget: Self-action: @selector (deleteFeed: _fId) for control events: UIControlEventTouchUpInside];   

_fId is a value that I am trying to understand how to send the deleteFeed function, I know that it should be something simple, but when I do a Google search I do not pinned it down can do.

AddTarget has set the parametric set and you can not send custom.

As an alternative solution, you can do the following: Use the following API and set _fId as the tag:

  Action: @Selector (Delphid :)   

ie

  [deleteBtn setTag: _fId] [deleteBtn addTarget: auto operation: @selector (deleteFeed :) forControlEvents: UIControlEventTouchUpInside];   

Now to identify the button, retrieve the button from the related tag.

  - (zero) deleteFeed: (UIButton *) Sender {[Delete yourself with: sender. Tag]; // or the argument to open the place is right here)   

I hope it helps.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -