Created
October 14, 2013 17:57
-
-
Save rcdilorenzo/6979461 to your computer and use it in GitHub Desktop.
How to make a button with a partially transparent background. See http://stackoverflow.com/questions/19274124/how-can-i-change-the-alpha-channel-of-a-button-in-ios-without-affecting-the-text/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewDidLoad { | |
[super viewDidLoad]; | |
SODimButton *button = [[SODimButton alloc] initWithFrame:CGRectMake(self.view.frame.size.width / 2 - 100, 50, 200, 44)]; | |
[button setTitle:@"My Button" forState:UIControlStateNormal]; | |
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; | |
button.buttonColor = [UIColor redColor]; | |
button.selectedButtonColor = [UIColor colorWithRed:0.73f green:0.10f blue:0.00f alpha:1.00f]; | |
button.backgroundAlpha = 0.2f; | |
[self.view addSubview:button]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment