Reputation: 1278
Ok, Here is the Hierarchy of my View.
Main View
|---------------|---------------|
UIView UIView UIView
| | |
UIButtons UIButtons UIButtons
As Above figure shows I have 3 subViews of Tag 111,222,333.
And Each Sub-view contains 25 buttons. One view is visible at a time, so m hiding the other 2 view by tag property.
App Description: My app having images on buttons and m showing those image on click of buttons. User can be able to click only one button at a time , and on second click m comparing the images of the buttons if the two images of buttons are not same, the image of button is hided and if they are same, they r not hidden.
All is going well on simulator, but on device, if I click Two button simultaneously, they both open at same time. (while btnClickCount is 2)
i want my button to open only one at a time.
What i have tried :
I tried
self.view.userInteractionEnabled = NO;
[self performSelector:@selector(EnableUserInteraction) withObject:nil afterDelay:0.5];
on first button click but if touches are occuring at same time, then nothing happens, but it is working for single tap.
dont know what to do with this !!!!!
Please Help , Thanks in advance..........
Upvotes: 1
Views: 671
Reputation: 3802
UIButton has a boolean property 'enabled' So when you get a button click, you could set all the other buttons to
buttonName.enabled = NO;
Then, when you want them to be active again, set
buttonName.enabled = YES;
I'm not sure how your buttons are declared, but if they are IBOutlets with different names, you can easily by put all the names in an array, remove the one that is active, and enumerating through the rest.
Upvotes: 1