PRRefreshControl 0.2.1

PRRefreshControl 0.2.1

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最近发布2015年12月

Elethom Hunter 维护。



通用

针对滚动视图的另一种更好的刷新控件。

安装

用法

在您的视图控制器类中,使用 -viewDidLoad 进行设置

- (void)viewDidLoad
{
    [super viewDidLoad];

    ...

    PRRefreshControl *refreshControl = [[PRRefreshControl alloc] init];
    [refreshControl addTarget:self
                       action:@selector(refreshControlTriggered:)
             forControlEvents:UIControlEventValueChanged];
    self.refreshControl = refreshControl;
    [collectionView insertSubview:refreshControl atIndex:0];

    // Configure manually if needed
    CGFloat customMarginTop = 10.f;
    refreshControl.scrollViewContentInset = collectionView.contentInset;
    refreshControl.height -= customMarginTop;
    refreshControl.verticalOffset = customMarginTop * .5f;

    ...

}

响应动作

#pragma mark - Data

- (void)dataDidRefresh
{
    [self.refreshControl endRefreshing];
}

#pragma mark - Actions

- (void)refreshControlTriggered:(PRRefreshControl *)sender
{
    [self refreshData];
}

大功告成!

许可证

此代码根据 MIT 许可证 的条款和条件分发。

捐赠

您可以通过以下方式支持我:

:-)

联系