Skip to content

Instantly share code, notes, and snippets.

@iesta
Created September 10, 2013 14:41
Show Gist options
  • Save iesta/6510410 to your computer and use it in GitHub Desktop.
Save iesta/6510410 to your computer and use it in GitHub Desktop.
Create a button programmatically
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self
action:@selector(aMethod:)
forControlEvents:UIControlEventTouchDown];
[button setTitle:@"Show View" forState:UIControlStateNormal];
button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
[view addSubview:button];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment