I’ve seen several questions/answers related to entirely creating a button in code, but not one which would let me know how to change the button image in code, when I originally added the button to my NIB in Interface Builder. I know how to change the background in Interface Builder.. but I want to change it in code, so I can change it automagically.
I’ve seen several questions/answers related to entirely creating a button in code, but not
Share
Specify an IBOutlet in your controller class and connect it to the button in Interface Builder. After the view has been loaded from the NIB file (for example in viewDidLoad), you can access the properties of the button just as if you had instantiated it in code: