Assigning different labels dynamically
-
19-09-2019 - |
Question
After detecting Button sender through its tag in an action method, I want to dynamically assign some text to the corresponding Label (say, button tag+10 ) using some sort of temp UILabel var.
Hoping that's understandable?..english is not my native language :)
thank you.
Solution
In the containing view, you can use viewWithTag to get the object with a specific tag.
If you know the object is a UILabel, you can typecast it to get your label object.
If you are in your viewcontroller.m file:
UILabel* myLabel;
myLabel = (UILabel*)[self.view viewWithTag:(buttonTag+10)];
Good luck!
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow