JNJProgressButton 0.2

JNJProgressButton 0.2

测试已测试
语言语言 Objective-CObjective C
许可证 MIT
发布上次发布2014年12月

Josh Johnson维护。




  • 作者
  • Josh Johnson

作为 Objective-C Hackathon 的一部分,我想尝试创建一个用于显示进度的按钮,就像新 iOS 7 版本的 App Store 中的进度按钮一样。这个进度按钮是将 UIButton 和 UIProgressView 结合起来,再加上其他一些东西的产物。也许它会有用,也许只是好玩。由你决定。

Progress in Action

待办事项

  • 使用 AutoLayout 进行更好的测试。
  • 添加对更好的结束状态按钮的支持。
  • 重构愚蠢的代码。
  • 适当处理 -tintColor 以备后续。

使用方法

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.progressButton.delegate = self;
    self.progressButton.tintColor = [UIColor blueColor];
    self.progressButton.startButtonImage = [UIImage imageNamed:@"download-image"];
    self.progressButton.endButtonImage = [UIImage imageNamed:@"action-image"];
}   

- (void)progressButtonStartButtonTapped:(JNJProgressButton *)button
{
    // Begin doing the download action or whatever asyncronous thing you need to do. Then start updating the progress progerty on the button.
}

- (void)progressButtonEndButtonTapped:(JNJProgressButton *)button
{
    // The button has reached the end of the progress and the user can now do whatever the action needed.
}

- (void)progressButtonDidCancelProgress:(JNJProgressButton *)button
{
    // The user has canceled the progress
}

致谢

联系

许可证

JNJProgressButton 可在 MIT 许可下获得,请参阅 LICENSE 文件以获取更多信息