Answer the question
In order to leave comments, you need to log in
How to pass parameter to UIAlertAction?
Good day.
Essence of a question: there is a table, on the right there is a button (at each cell). On click - show UIAlertActionController.
Well, we indicate the actions. When a specific action is selected, a request is sent to the server.
Let's say deleting an object. The object ID must go to the server. How do I specify this for a given action? that is, how to find out when clicking the element ID? Where to assign it or how to extract it?
Thanks
Answer the question
In order to leave comments, you need to log in
Hello.
as an option:
- save the ID in the "operatableObjectID" type property
- when you click on the allert button, take the ID from the property.
probably the best option:
- the viewController is indicated by the delegate for the cell
- the delegate has the method didTouchAllertButtonInCell: (UICell *)cell
- the viewController implements the didTouchAllertButtonInCell: method,
- in the method - its index is determined by the cell and we find the ID by the index
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question