UIButton With Custom Stretchable UIImage


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



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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.