code_junkie

How to tint a UIButton?

Nov 11th, 2011
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. UISegmentedControl *cancelButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Cancel"]];
  2. [cancelButton setSegmentedControlStyle:UISegmentedControlStyleBar];
  3. [cancelButton setTintColor:[UIColor colorWithRed:0.8 green:0.3 blue:0.3 alpha:1.0]];
  4. [cancelButton setMomentary:YES];
  5. [cancelButton addTarget:self action:@selector(didTapCancel:) forControlEvents:UIControlEventValueChanged];
  6. [self addSubview:cancelButton];
  7. [cancelButton release];
Add Comment
Please, Sign In to add comment