I have a button that should be activated after the user selects a photo from library or take a photo. But as long as there is no photo the button should not work.
I have a button that should be activated after the user selects a photo from library or take a photo. But as long as there is no photo the button should not work.
2
Answers
UIButton has a property called
isEnabled
(refer to Apple Docs).To enable the button you can write:
More detailed explanation:
First of all you need to disable the button, when the ViewController is loaded. Ideally you do this in the
viewWillAppear
function:And when the photo is loaded you can enable the button:
Before the user selects a photo from library or take a photo
After the user selects a photo from library or take a photo