I’ve tried all the answers I found on SO, so either I have a different problem or the heat got to my brain.
Anyway, I have a UIButton on a storyboard, it’s linked to an IBAction called _cameraButtonPress (the UIButton is called _cameraButton). When the button is pressed I want to disable the button for a time, so I immediately call [sender setEnabled:NO]; and this works fine. However, in a different function which saves out the image, on successful save I use [_cameraButton.setEnabled:YES]; This does not work.
If I replace sender with _cameraButton in the function called by the IBAction, this also does not work. I have the UIButton linked with an IBOutlet.
I can post code, but it’s quite a big project now, here are the relevant bits:
In the header…
IBOutlet UIButton *_cameraButton;
The IBAction…
- (IBAction) _cameraButtonPress:(id)sender {
[sender setEnabled:NO]; //stops button responding to touch events
Further on down in a different function:
} else {
NSLog(@"colour image saved successfully");
[_cameraButton setEnabled:YES];
}
Any ideas?
Thanks.
Are you sure you have connected _cameraButton with the
UIButton? Try logging _cameraButton to see if it holds a reference to a valid object.