//
// PowerBankViewController.h
#import <QuartzCore/QuartzCore.h>
IBOutlet UIButton *btn10;
IBOutlet UIButton *btn20;
@property (nonatomic, retain) IBOutlet UIButton *btn10;
@property (nonatomic, retain) IBOutlet UIButton *btn20;
-(void)setUIButtonColor:(UIButton *)button setColor:(UIColor *)color;
//
// PowerBankViewController.m
@synthesize btn10,btn20;
- (void)viewDidLoad {
[self setUIButtonColor:btn10 setColor:[UIColor redColor]];
[self setUIButtonColor:btn20 setColor:[UIColor redColor]];
}
- (void)setUIButtonColor:(UIButton *)button setColor:(UIColor *)color
{
[[button layer] setCornerRadius:8.0f];
[[button layer] setMasksToBounds:YES];
[[button layer] setBorderWidth:1.0f];
[[button layer] setBorderColor:[[UIColor blackColor] CGColor]];
[[button layer] setBackgroundColor:[[UIColor blueColor] CGColor]];
[button setBackgroundColor:color];
}
沒有留言:
張貼留言