测试已测试 | ✗ |
Lang语言 | Obj-CObjective C |
许可协议 | MIT |
发布上次发布 | 2016 年 4 月 |
由 Sarun Wongpatcharapakorn 维护。
This UIButton subclass replicate single line border button see in iOS 7 App Store.
您还可以使用以下方法快速尝试 SWFrameButton 示例项目
pod try SWFrameButton
需要 iOS 7.0+ 和 ARC。
SWFrameButton 是通过 tintColor
来决定其颜色的,所以尽量通过 setTitleColor:forState:
设置文本颜色,这样做不会破坏您的按钮,但也可能引发不一致的高亮/选择颜色状态。《界面构建器》中的《文本颜色》属性将因此被忽略,使用《视图》部分中的《着色》属性替代。
基本用法
SWFrameButton *button = [[SWFrameButton alloc] init];
[button setTitle:@"Green Tint Button" forState:UIControlStateNormal];
[button sizeToFit];
button.tintColor = [UIColor greenColor];
如果您使用界面构建器,请将 UIBUtton 添加到界面中,并将类设置为 SWFrameButton
。
您可以通过 UIAppearance 或通过属性设置单个按钮样式来自定义 SWFrameButton
[[SWFrameButton appearance] setTintColor:[UIColor orangeColor]];
[[SWFrameButton appearance] setBorderWidth:1];
[[SWFrameButton appearance] setCornerRadius:10];
来使用
SWFrameButton *button = [[SWFrameButton alloc] init];
button.tintColor = [UIColor orangeColor];
button.borderWidth = 1;
button.corderRadius = 10;
Sarun Wongpatcharapakorn (@sarunw)
SWFrameButton 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。