Disable button click event on iPhone

I am new to iPhone development.

In my application

I want to disable the button click event on the first click by the user. for this purpose i tried

buttonname.Enable=FALSE; 

But the button image is also erased, as it turns off. I want to show the image correctly, and the button should be disabled, as in time. what to do? Please help me. Thank you for your time.

+4
source share
4 answers

Set buttonname.userInteractionEnabled = NO; This will disable the button name action, but UIButton will be displayed. Only an event with a click will not work.

+14
source

Use this code, it can help you.

 [buttonName addTarget:self action:nil forControlEvents:UIControlEventTouchDown]; 
+1
source

on objective-c you are not using TRUE or FALSE, you are using YES or NO

buttonname.enabled = NO;

0
source

Try setting the userInteractionEnabled property to NO .

0
source

Source: https://habr.com/ru/post/1432084/


All Articles