Last Updated on 05.09.13 Written by Mike Zriel
Once you have created an object unless you created a property for it, it can be hard to access the object, like changing an image or changing the pressed method to call for a button, here is how you do it:
First assign a tag to the object when you create it, a tag is simply a number is can be positive or negative:
How later in the code I wan to cancel the target or change the image for example:
What to remember is : UIButton *buttonNext =( (UIButton *) [self.view viewWithTag:-2]);
You can do this for any object : UIImageView *imageExample =( (UIImageView *) [self.view viewWithTag:23]);
You can use 'id' if you do not know what type of object it is, but is it better to get the correct type of object so the auto complete comes up.