Using stretchable images in Obj-C buttons


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



Copy this code and paste it in your HTML
  1. UIImage *buttonImageNormal = [UIImage imageNamed:@"whiteButton.png"];
  2. UIImage *stretchableButtonImageNormal = [buttonImageNormal stretchableImageWithLeftCapWidth:12 topCapHeight:0];
  3. [doSomethingButton setBackgroundImage:stretchableButtonImageNormal forState:UIControlStateNormal];
  4.  
  5. UIImage *buttonImagePressed = [UIImage imageNamed:@"blueButton.png"];
  6. UIImage *stretchableButtonImagePressed = [buttonImagePressed stretchableImageWithLeftCapWidth:12 topCapHeight:0];
  7. [doSomethingButton setBackgroundImage:stretchableButtonImagePressed forState:UIControlStateHighlighted];

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.