I am working on a project in which I have to show all photos of Photo Library in a plist and show them horizontally on UIButton
s.
My app will also have an edit button: when the user clicks this button, a delete mark (such as usually appears in other iPhone/iPad apps) should show on each button.
But here's the crucial bit: as soon as this delete mark appears, the functionality of the button should be disabled. I've tried accomplishing this with the following:
{ editbutton.enabled=NO; }
...but it neither produces an error nor works. What should I do?
The quickest way to disable the button in Swift is to simply set the button's isEnabled property to false. For example button. isEnabled = false.
If you want to check If UIButton is Pressed or not, You should handle TouchDown Handler and change button's state to pressed in touchDown hadnler. You can track ToucUpInside method to Change state of button to Not-pressed again.
To disable a button, you should use the disabled view modifier. It takes bool parameter, which for example, can be taken from the state. You can use the disabled modifier on a view above buttons ( VStack , for example). That way, you will apply it to all buttons (or other controls below).
Please set this...
editButton.userInteractionEnabled = NO;
or You can use
editButton.enabled = NO;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With