Last active
January 4, 2016 18:08
-
-
Save alvareztech/8658210 to your computer and use it in GitHub Desktop.
iOS: Add UIButton programmatically.
This file contains hidden or 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
UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; | |
[myButton setTitle:@"My Text" forState:UIControlStateNormal]; | |
[myButton addTarget:self action:@selector(aMethod:) forControlEvents:UIControlEventTouchDown]; | |
myButton.frame = CGRectMake(10, 10, 100, 44); | |
[self.view addSubview:myButton]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment