Search code examples
iphonexcodeuibuttonuigesturerecognizeruitouch

Increasing UIButton size temporarily on touch


Im creating an app which has 10 buttons and each has an IBAction to go into the next view. What I want is that on touch the size of the button increases till the user does not take his finger away. Also on double tap the IBAction is called. Now the question is should I use gestures for this ?

One solution is to change the buttons into imageviews and then use their methods in the gestures. But I want to keep the buttons likewise .... Any solution would be appreciated. Thanx.


Solution

  • Change the image of the button on touch .

    [myButton setImage:[UIImage imageNamed:@"enter.png"] forState:UIControlStateNormal];
    
    [myButton setImage:[UIImage imageNamed:@"enter-hover.png"] forState:U UIControlStateSelected];