| 测试已测试 | ✗ |
| 语言语言 | Obj-CObjective C |
| 许可证 | MIT |
| 发布最后发布 | 2015年5月 |
由 Guilherme Araújo 维护。
CocoaPods (推荐)
将以下行添加到您的 Podfile
pod 'GUIRoundProgressButton', '~> 0.0.2
然后,在您的视图控制器中添加 #import <GUIRoundProgressButton.h>
手动
将文件夹 Classes 复制到您的项目中,然后将 #import "GUIRoundProgressButton.h" 添加到您的视图控制器。
要使用它,您应创建一个扩展 GUIRoundProgressButton 的视图控制器。这可以通过两种方式完成
UIView 对象添加到您的视图中GUIRoundProgressButtonIBOutletGUIRoundProgressButton *button = [GUIRoundProgressButton buttonWithCenter:<#CGPoint#> radius:<#CGFloat#>];[self.view addSubview:button];以下是您可以使用的方法来自定义按钮的外观和感觉。其中,“touch”方法与按钮被用户按下时的颜色相关。
- (CGFloat)setContentPadding;- (CGFloat)setBorderWidth;
- (UIColor *)setBorderColor;
- (UIColor *)setTouchBorderColor;- (UIColor *)setForegroundColor;
- (UIColor *)setTouchForegroundColor;- (UIColor *)setProgressIndicatorColor;- (void)setImage:(UIImage *)image;- (void)setText:(NSString *)text;
- (void)setAttributedText:(NSAttributedString *)text;注意:图像或文本中必有其一可见。如果两者都设置,则最后设置的会被使用。
这是按钮被轻触后的动作。
- (void)setActionBlock:^(GUIRoundProgressButton *weakButton);[button setActionBlock:^(GUIRoundProgressButton *weakButton) {
// Perform your tasks here
// At the end, call finish using the weak reference to prevent memory leaks
[weakButton finish];
}];注意: 不要忘记在完成任务后调用 finish 方法。使用按钮的弱引用以防止内存泄露。