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

/ Published in: Objective C
Save to your folder(s)

Copy this code and paste it in your HTML
  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


RSS Icon Subscribe to comments

You need to login to post a comment.