Skip to content

Instantly share code, notes, and snippets.

@derektu
Created December 24, 2012 10:27
Show Gist options
  • Save derektu/4368738 to your computer and use it in GitHub Desktop.
Save derektu/4368738 to your computer and use it in GitHub Desktop.
Manually create and hookup ImageButton
UIButton* btn = ..;
UIImage* imageForButtonFace = ..;
UIImage* imageForHighlight = ..;
[btn setBackgroundImage:[factory getButtonFaceImageFor:imageForButtonFace] forState:UIControlStateNormal];
[btn setBackgroundImage:[factory getButtonHighlightImageFor:imageForHighlight] forState:UIControlStateHighlighted];
[btn addTarget:self action:@selector(btnClicked:) forControlEvents:UIControlEventTouchUpInside];
- (void)btnClicked:(UIButton*)sender
{
// Button click event handler
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment