BOZPongRefreshControl 1.0.1

BOZPongRefreshControl 1.0.1

测试已测试
Lang语言 Obj-CObjective C
许可 MIT
Released上次发布2014年12月

Ben Oztalay 维护。



  • Ben Oztalay, Joseph Constan, Mahir Eusufzai 和 ajfigueroa

用于 iOS 的下拉刷新控件,可以玩 Pong 游戏。

安装

它在 CocoaPods 上!在 Podfile 中添加 pod 'BOZPongRefreshControl'

或者,只需将 BOZPongRefreshControl.hBOZPongRefreshControl.m 文件放在您项目的任何位置。

使用方法

将其附加到 UITableViewUIScrollView 如下所示

- (void)viewDidLoad
{
    [super viewDidLoad];

    /* NOTE: Do NOT attach the refresh control in viewDidLoad!
     * If you do this here, it'll act very funny if you have
     * a navigation bar or other such similar thing that iOS
     * automatically offsets content for. You have to wait for
     * the subviews to get laid out first so the refresh
     * control knows how big that offset is!
     */
}

- (void)viewDidLayoutSubviews
{
    self.pongRefreshControl = [BOZPongRefreshControl attachToTableView:self.tableView
                                                     withRefreshTarget:self
                                                      andRefreshAction:@selector(refreshTriggered)];
}

然后,在您的 UIViewController 中实现 UIScrollViewDelegate,如果尚未实现,然后将调用传递给刷新控件

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    [self.pongRefreshControl scrollViewDidScroll];
}

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
    [self.pongRefreshControl scrollViewDidEndDragging];
}

最后,确保您已经实现了您之前传递给它的 refreshAction 以监听刷新触发器

- (void)refreshTriggered
{
    //Go and load some data

    //Finshed loading the data, reset the refresh control
    [self.pongRefreshControl finishedLoading];
}

有关更多详细信息,请查看演示应用的代码。它有在 UIScrollView 上以及在 UITableViewController 外部使用刷新控件的示例。

配置

  • 使用 foregroundColor 属性设置前景色
  • 使用 backgroundColor 属性设置背景色
  • 通过更改 totalHorizontalTravelTimeForBall 属性来调整其播放速度

已知问题/待办事项

  • 它将与 UIScrollView 内容冲突,该内容位于 y = 0.0f 以上
  • 我还没有测试它,但我打赌它在 iPad 上看起来有点傻
  • 在物理 iPhone 6/+ 上测试它
  • 需要改进 paddle 的行为
  • 进行测试!