[Solved] Create action after multiple clicks on UIButton [closed]


At the top of implementation file create a count variable

@interface yourViewController (){
    int buttonCount;
}

initialize somewhere (for ex. viewDidLoad)

buttonCount = 0;

in your IBAction (assuming you’ve linked your UIButton to an IBAction)

- (IBAction)yourButton:(id)sender{

   buttonCount++;

   if (buttonCount >= 10){ // button clicked 10 or more times

      //do something

      buttonCount = 0;//if you need to reset after action
   }

}

5

solved Create action after multiple clicks on UIButton [closed]