Posted By

BenClayton on 02/09/11


Tagged


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

iure
athanhcong
Tintenklecks
gospaz
cnathan


iPhone: Create custom button that flashes on touch (like the info button)


 / Published in: Objective C
 

  1. UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeCustom];
  2. infoButton.showsTouchWhenHighlighted = YES; // make it flash when touched
  3. [infoButton setImage:[UIImage imageNamed:@"help.png"] forState:UIControlStateNormal];
  4. infoButton.frame = CGRectMake(35, 20, 32,
  5. [infoButton addTarget:self action:@selector(infoButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
  6. [self addSubview:infoButton];

Report this snippet  

You need to login to post a comment.