设置Button样式

- (void)changeButtonGrayStyle:(UIButton *)button {
    button.layer.borderColor = [UIColor lightGrayColor].CGColor;
    button.layer.borderWidth = 1;
    button.layer.masksToBounds = true;
    button.layer.cornerRadius = 4;
    [button setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    button.backgroundColor = [UIColor whiteColor];
}

- (void)changeButtonRedStyle1:(UIButton *)button {
    button.layer.borderColor = [UIColor colorWithRed:228/255.0 green:14/255.0 blue:64/255.0 alpha:1].CGColor;
    button.layer.borderWidth = 1;
    button.layer.masksToBounds = true;
    button.layer.cornerRadius = 4;
    [button setTitleColor:[UIColor colorWithRed:228/255.0 green:14/255.0 blue:64/255.0 alpha:1] forState:UIControlStateNormal];
    button.backgroundColor = [UIColor whiteColor];
}

- (void)changeButtonRedStyle2:(UIButton *)button {
    button.layer.borderWidth = 0;
    button.layer.masksToBounds = true;
    button.layer.cornerRadius = 4;
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    button.backgroundColor = [UIColor colorWithRed:228/255.0 green:14/255.0 blue:64/255.0 alpha:1];
}

你可能感兴趣的:(设置Button样式)