Skip to content

Instantly share code, notes, and snippets.

@peterlee0127
Created June 25, 2012 14:06
Show Gist options
  • Save peterlee0127/2988851 to your computer and use it in GitHub Desktop.
Save peterlee0127/2988851 to your computer and use it in GitHub Desktop.
ios button
UIColor *buttonColorDefault = [UIColor colorWithRed:90.0f/255.0f green:90.0f/255.0f blue:90.0f/255.0f alpha:1.0];
UIColor *buttonColorHighlight = [UIColor colorWithRed:255.0f/255.0f green:255.0f/255.0f blue:255.0f/255.0f alpha:1.0];
UIImage *btn = [UIImage imageNamed:@"Button.png"];
UIImage *btnh = [UIImage imageNamed:@"ButtonHighlighted.png"] ;
// building the buttons
UIButton *aboutBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[aboutBtn addTarget:self action:@selector(showAboutPage) forControlEvents:UIControlEventTouchUpInside];
[aboutBtn setTitle:@"登入" forState:UIControlStateNormal];
[aboutBtn setFrame:CGRectMake(80.0,320.0, 162.0, 42.0)];
[aboutBtn setBackgroundImage:btn forState:UIControlStateNormal];
[aboutBtn setBackgroundImage:btnh forState:UIControlStateHighlighted];
[aboutBtn setTitleColor:buttonColorDefault forState:UIControlStateNormal];
[aboutBtn setTitleColor:buttonColorHighlight forState:UIControlStateHighlighted];
// place the button into the view
[self.view addSubview:aboutBtn];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment