Posted By

paki on 10/13/11


Tagged

custom UIButton


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

mirage3d
weidel
cnathan


UIButton With Custom Stretchable UIImage


 / Published in: Objective C
 

  1. UIImage *imgBtnBack = [[UIImage imageNamed:@"button_left.png"] stretchableImageWithLeftCapWidth:15 topCapHeight:0];
  2. UIButton *btnBack = [UIButton buttonWithType:UIButtonTypeCustom];
  3. [btnBack setBackgroundImage:imgBtnBack forState:UIControlStateNormal];
  4. [btnBack setTitle:@" Back" forState:UIControlStateNormal];
  5. [btnBack titleLabel].font = [UIFont boldSystemFontOfSize:11.0];
  6. [btnBack setTitleColor:[UIColor colorWithRed:244.0/255.0 green:190.0/255.0 blue:0.0/255.0 alpha:255.0/255.0] forState:UIControlStateNormal];
  7. btnBack.frame = CGRectMake(6, 6, 58, 34);
  8. [btnBack addTarget:self action:@selector(viewGoBack:) forControlEvents:UIControlEventTouchUpInside];

Report this snippet  

You need to login to post a comment.