Skip to content

Instantly share code, notes, and snippets.

@nanmo
Created April 16, 2013 04:01
Show Gist options
  • Save nanmo/5393249 to your computer and use it in GitHub Desktop.
Save nanmo/5393249 to your computer and use it in GitHub Desktop.
http://charles.lescampeurs.org/2011/02/10/tint-color-uibutton-and-uibarbuttonitem をとりあえずARC対応させた(autorelease抜いた)だけ
#define UIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
- (void)viewDidLoad
{
/* Create a tinted "UIButton" */
UISegmentedControl *button3 = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"Add", nil]];
button3.frame = CGRectMake(0, 0, 160, 33);
button3.center = self.view.center;
button3.momentary = YES;
button3.segmentedControlStyle = UISegmentedControlStyleBar;
button3.tintColor = UIColorFromRGB(0x0000DD);
[self.view addSubview:button3];
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment