It seems like the usual way to make text behave like an iOS link is to make UIButton, but I noticed that the UIButton addTarget or gestureRecognizer addTarget have no argument that can be passed to the method when the button is clicked?
The situation is that from the server we can return a list of words such as "pineapple", "apple", "orange", and the numbers can change. These words are displayed on the screen, and clicking on the word will call the ViewController to replace the main view controller.
It seems that one way is to use the UIButton tag, so when we configure the button, we give it the 0 tag, and in another array of the current view or view controller, we make the 0 element a point for the NSString object containing the word "pineapple". And so in the handler, the tag can be retrieved, and it can be used to retrieve the string. But this is the only way, because it does not seem very structural. Is there a better way?
source share