Is there anyway to access a UIbutton from another UIbuttons IBAction method when creating the UIbuttons programmatically? I was able to do this using interface builder by creating an IBOutlet for each of them and referencing them that way, but I need to create the buttons programmatically and can’t seem to figure out if this is possible?
Thanks!
When you create the buttons, assign them to ivars in your controller. Then your IBAction methods can access any of these ivars as needed.
For example, in your view controller header you might have:
In your implementation you would create your buttons something like this:
Then in your IBAction method you might do something like this:
Make sense? (This is all coded from memory and not tested, fwiw.)