Skip to content

Instantly share code, notes, and snippets.

@Mil0R
Created December 28, 2013 02:19
Show Gist options
  • Save Mil0R/8155326 to your computer and use it in GitHub Desktop.
Save Mil0R/8155326 to your computer and use it in GitHub Desktop.
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = aFrame;// a rect can contain your image and your text label
UIImage *image = [UIImage imageNamed:@"image"];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:iFrame];// image frame on left of button
imageView.image = randomImage;
imageView.backgroundColor = [UIColor clearColor];
[button addSubview:imageView];
UILabel *label = [[UILabel alloc] initWithFrame:lFrame];//text frame on right of button
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont systemFontOfSize:14];
label.textAlignment = NSTextAlignmentCenter;
label.textColor = [UIColor blackColor];
label.text = NSLocalizedString(@"53", nil);
[button addSubview:label];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment