按钮外观 0.1.1

按钮外观 0.1.1

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布上次发布2016年3月

Alex Hsieh 维护。



  • 作者:
  • Alex Hsieh

使用方法

要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install

如果您需要在不同的控件状态下使用不同的边框颜色或阴影颜色,则需要子类化 AHButton。

Button shadow changed with state

[self.buttonFromStoryBoard setShadowColor:shadowColor  offset:CGSizeMake(0, 3.0) opacity:1.0 radius:1.0 forState:UIControlStateNormal];
[self.buttonFromStoryBoard setShadowColor:buttonColor  offset:CGSizeMake(0, 3.0) opacity:1.0 radius:1.0 forState:UIControlStateHighlighted];

Button border changed with state

[self.buttonFromStoryBoard2 setCornerRadius:10.0 borderWidth:1.0 borderColor:[UIColor blackColor] forState:UIControlStateNormal];
[self.buttonFromStoryBoard2 setCornerRadius:10.0 borderWidth:1.0 borderColor:[UIColor grayColor] forState:UIControlStateHighlighted];

如果您只需要在 diferentes 控件状态下更改 UIButton 背景颜色或背景渐变,请使用 UIbutton+Appearance 分类。

Button background color changed with state

[button3 setBackgroundColor:[UIColor yellowColor] forState:UIControlStateNormal];
[button3 setBackgroundColor:[UIColor greenColor] forState:UIControlStateHighlighted];

Button background gradient changed with state

[button4 setBackgroundGradient:@[[UIColor grayColor],[UIColor blackColor]] forState:UIControlStateNormal];
[button4 setBackgroundGradient:@[[UIColor lightGrayColor],[UIColor blackColor]] forState:UIControlStateHighlighted];

需求

仅有 ARC;iOS 5.0+ / OSX 10.7+

安装

通过 Cocoa pods ButtonAppearance 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 文件中:

pod "ButtonAppearance"

作者

Alex Hsieh,[email protected]

许可证

ButtonAppearance 在 MIT 许可证下提供。有关更多信息,请参阅 LICENSE 文件。