Skip to content

Instantly share code, notes, and snippets.

@iranjith4
Created June 21, 2016 05:27
Show Gist options
  • Save iranjith4/8d8f358abdf877bf0d066603e3aa2477 to your computer and use it in GitHub Desktop.
Save iranjith4/8d8f358abdf877bf0d066603e3aa2477 to your computer and use it in GitHub Desktop.
UIButton *myButton = [[UIButton alloc] initWithFrame:CGRectMake(10, 300, 100, 40)];
[myButton setTitle:@"My Button" forControlState : UIControlStateNormal];
[myBytton setImage:[UIImage imageNamed:@"unselectedImage"] forState : UIControlStateNormal];
[myBytton setImage:[UIImage imageNamed:@"selectedImage"] forState : UIControlStateSelected];
[myButton addTarget:self action:@selctor(myButtonTapped) forControlEvents:UIControlEventsTouchUpInside];
[self.view addSubview:myButton];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment