First a tip, if you only have button's calling that selector, you can change the id
to UIButton*
and drop the extra variable bCustom
.
Now, to solve your issue, you just need to ensure you turn userInteractionEnabled
back to YES
after you'd done whatever else you needed to do. Using the animation block is just an easy way because it has a completion handler built in.
You can do this simply by having selectTabControllerIndex
method do the work for you.
Something like this:
- (IBAction)btnAction:(UIButton*)sender { sender.userInteractionEnabled = NO; [self selectTabControllerForButton:sender];}- (void)selectTabControllerForButton:(UIButton*)sender { // Whatever selectTabControllerIndex does now goes here, use sender.tag as you used index sender.userInteractionEnabled = YES;}
If you possibly had other code you needed to execute afterwards, you could add a completion handler to your selectTabControllerIndex
method instead and then call the completion handler. Inside that you'd include the sender.userInteractionEnabled = YES;
line. But if it's always the same code, the first way is easier and faster.