Reputation: 1115
I'm creating a calendar and have a few dozen UILabels, each with a unique tag set in storyboard so that I can reference them individually.
I update the tag to 1000 after some user interactions, but need the tags to go back to the original tags set in storyboard after other user interactions.
Is this possible? Can I change UILabel tags to 1000 at one point and have them reset automatically to what was originally set in the storyboard at another point?
If not, I'll just create a for loop that runs through all the labels and resets the tags.
Upvotes: 0
Views: 131
Reputation: 11201
If you set a tag in the storyboard, and in your code you change the tag to any number, the compiler will consider the thing that you set in the code (the latest tag value). If you want to set to the previous tag, you just need to do it again in your code.
Storyboard settings will work great as long as you don't change them in your code. Once you change them, you will lose the storyboard settings and you can't get them back. Unless you do something to save those settings in your code.
Upvotes: 1