扁平化按钮
QBFlatButton 可以使用 CocoaPods 安装。
pod 'QBFlatButton'
或者克隆这个仓库,并将 QBFlatButton.h
手动包含到你的项目中。
按钮的表面颜色。
@property (nonatomic, strong) UIColor *surfaceColor
按钮的边缘颜色。
@property (nonatomic, strong) UIColor *sideColor
按钮的边框颜色。
@property (nonatomic, strong) UIColor *borderColor
按钮的圆角半径。
@property (nonatomic, assign) CGFloat cornerRadius
正常状态下的按钮高度。
@property (nonatomic, assign) CGFloat height
按钮按下时的深度。
@property (nonatomic, assign) CGFloat depth
按钮的边框宽度。
@property (nonatomic, assign) CGFloat borderWidth
QBFlatButton *button = [QBFlatButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(90, 200, 140, 50);
button.surfaceColor = [UIColor colorWithRed:0.333 green:0.631 blue:0.851 alpha:1.0];
button.sideColor = [UIColor colorWithRed:0.310 green:0.498 blue:0.702 alpha:1.0];
button.borderColor = [UIColor colorWithRed:0.310 green:0.498 blue:0.702 alpha:1.0];
button.cornerRadius = 6.0;
button.height = 4.0;
button.depth = 3.0;
button.titleLabel.font = [UIFont boldSystemFontOfSize:16.0];
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[button setTitle:@"QBFlatButton" forState:UIControlStateNormal];
[self.view addSubview:button];
QBFlatButton 在 MIT 许可证 下发布,请查阅 LICENSE.txt。