Posted By

BenClayton on 02/09/11


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite


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  


RSS Icon Subscribe to comments
Posted By: barryflash2727 on September 21, 2018

good post

Posted By: milessmith on November 19, 2018 hanks for sharing.I found a lot of interesting information here. A really good post, very thankful and hopeful that you will write many more posts like this one.

Posted By: stan on November 6, 2019

Good work. Contact our company for iOS app development App Development services at Trueleaftech

You need to login to post a comment.