Animated, customizable, and flexible pull-to-refresh framework for faster and easier iOS development.

Overview

KafkaRefresh

Animated, customizable, and flexible pull-to-refresh framework for faster and easier iOS development.

Report bug · Request feature · 中文文档


Status

GitHub license CocoaPods Compatible platform language Email


Screenshots

KafkaRefreshStyle Top Screenshots Bottom Screenshots
Native
ReplicatorWoody
ReplicatorAllen
ReplicatorCircle
ReplicatorDot
ReplicatorArc
ReplicatorTriangle
AnimatableRing
AnimatableArrow

Features

  • Built-in rich animation style, support self-customization

  • Non-refresh state hidden automatically

    To avoid developers manually adjust contentInset refresh the appearance of the control after the impact of the visual experience;
    the most common situation, the absence of data, the bottom of the refresh control is not hidden, the use of KafkaRefresh to avoid the problem.

  • Anti-dithering at the end of the refresh

    When the refresh control finishes refreshing, if UIScrollView is in a scrolling state, KafkaRefresh will adjust the contntOffset that controls the UIScrollView at this time according to the refresh control.

  • Support setting the offset threshold to trigger refresh

    Setting the value of stretchOffsetYAxisThreshold can control the refresh pull distance.This property is a ratio relative to the height of the control and must be set greater than 1.0.

  • Support global setting

    KafkaRefreshDefaults is a singleton for global settings

  • Support progress callback

    Real-time callback Drag the offset ratio, for the expansion of the interface, according to the progress of adjustment animation.

  • Adaptive contentInset system adjustment and manual adjustment

    Adaptive UINavigationController for UIScrollView's contentInset property adjustment, even if the contentInset automatically set value, then KafkaRefresh can still adapt this adjustment.

  • Solve the section view floating problem when refreshing

  • Support horizontal and vertical screen switching adaptive

    No need to consider in the horizontal and vertical screen refresh refresh problem.

  • iOS 7+

    Support iOS 7 above system. Including iPhone X.

  • Support auto refresh

    When the user slides the scrollview to the bottom, the refresh will be triggered automatically, without the user having to slide to the bottom and pull up the scrollview. This feature is not enabled by default, because most people will use the function without viewing the document. If it is not used correctly, it will be easy to cause the refresh to stop.

    Use the preload feature, please strictly follow the requirements below:

    • self.tableView.footRefreshControl.autoRefreshOnFoot = YES; please set autoRefreshOnFoot TRUE;

    • in refreshHandler,Strictly follow the logic below!

       if ({No data needs to be stitched}) {
           [weakSelf.tableView.footRefreshControl endRefreshingAndNoLongerRefreshingWithAlertText:@"no more"];
       } else {
           [weakSelf.tableView.footRefreshControl endRefreshingWithAlertText:@"did load successfully" completion:nil];
       }
  • Document coverage 100%

    You can see the use of all methods and classes in the header file.

Installation

  • CocoaPods
pod 'KafkaRefresh'
  • Carthage

If anyone wants to install by carthage , please supply a pull request. I'm not using this package manager myself.

Usage

 #import "KafkaRefresh.h" 
Initialization
  • The first way
#pragma mark - head

[self.tableView bindHeadRefreshHandler:^{
        
    } themeColor:MainColor refreshStyle:KafkaRefreshStyleAnimatableArrow];

#pragma mark - foot

[self.tableView bindFootRefreshHandler:^{
        
    } themeColor:MainColor refreshStyle:KafkaRefreshStyleAnimatableArrow]; 

#pragma mark - auto refresh

self.tableView.footRefreshControl.autoRefreshOnFoot = YES;
  • The second way
 KafkaArrowHeader * arrow = [[KafkaArrowHeader alloc] init];
 arrow.refreshHandler = ^{
	 //to do something... 
 };
 self.tableView.headRefreshControl = arrow;
  • The third way(global configuration)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
	[[KafkaRefreshDefaults standardRefreshDefaults] setHeaderDefaultStyle:KafkaRefreshStyleAnimatableRing];
	return YES;
}

#pragma mark - global

[self.tableView bindGlobalStyleForFootRefreshHandler:^{
        
}];
Trigger Refresh Manually
 [self.tableView.headRefreshControl beginRefreshing];
 [self.tableView.footRefreshControl beginRefreshing];
End Refresh

When you finish refreshing and don't need to show any hints, or any animation, call the following method.

- (void)endRefreshing; 

When you finish the refresh and need to display the prompt message, call the following method.

- (void)endRefreshingWithAlertText:(NSString *)text completion:(dispatch_block_t)completion; 

When you end the refresh and no longer need to refresh, call the following method.

- (void)endRefreshingAndNoLongerRefreshingWithAlertText:(NSString *)text;
Resume Refresh Available
/**
 After you call ‘endRefreshingAndNoLongerRefreshingWithAlertText’,
 you need to resume refresh available
 */
- (void)resumeRefreshAvailable;

Customize

Take KafkaheadRefreshControl as an example

 #import "KafkaheadRefreshControl.h"
 @interface CustomHeader : KafkafootRefreshControl
 @end
@implementation CustomHeader 

- (void)kafkaDidScrollWithProgress:(CGFloat)progress max:(const CGFloat)max{
   //progress callback
}

- (void)kafkaRefreshStateDidChange:(KafkaRefreshState)state{
   [super kafkaRefreshStateDidChange:state];
}
@end

Warnings And Precautions

  • Many people asked me a question that tableView jump after called insertRowAtIndexPath: withRowAnimation:,That Is Not Bug Of KafkaRefresh. Setting tableView.estimatedRowHeight = UITableViewAutomaticDimension; can solve this question when you initialize tableView;

  • Please update the latest version!

Communication

  1. If you need help,please email [email protected].
  2. If you found a bug,and can provide steps to reliably reproduce it, open an issue.
  3. Personal energy is limited, Kafka provides callback interface enough to increase the richer UI effect, we welcome you to join together and submit the pull request.

License

KafkaRefresh is released under the MIT license. See LICENSE for details.

FOSSA Status

Comments
  • Bundle arrow image is nil

    Bundle arrow image is nil

    • (UIImageView *)arrowImgV{ if (!_arrowImgV) { NSString *path = [[NSBundle mainBundle] pathForResource:@"Image" ofType:@"bundle"]; NSString *urlString = [path stringByAppendingPathComponent:@"arrow48.png"]; UIImage *image = [UIImage imageWithContentsOfFile:urlString]; _arrowImgV = [[UIImageView alloc] initWithImage:image]; _arrowImgV.layer.anchorPoint = CGPointMake(0.5, 0); } return _arrowImgV; }

    hi ,thanks for so great refresh Lib. when I. use it in KafkaRefreshStyleAnimatableArrow style ,the arrowImage return nil ,there sth went wrong ? I guess the path you get is wrong !

    bug 
    opened by wwwang89 9
  • Swift 中,使用 UIScrollView 嵌套 UIScrollView 时,下拉刷新控件的问题

    Swift 中,使用 UIScrollView 嵌套 UIScrollView 时,下拉刷新控件的问题

    • iOS最新版本
    • KafkaRefresh 最新版本 在一个 UIScrollView 中 嵌套另一个 UIScrollView 时; 父 ScrollView 设置代理; 子 ScrollView 的 isScrollEnabled 设为 false 且不设置代理; 在 scrollViewDidScroll 方法中通过监听父 ScrollView 的滚动来设置子 ScrollView 的 contentOffset 使其达到滚动的目的; 当父 ScrollView 的 contentOffset.y 为 < 0 时,子 ScrollView 的 contentOffset.y 也小于 0,但是刷新控件不会随子 ScrollView 显示出来; 尝试更换 MJRefresh 可以显示刷新控件; 希望作者可以解答; 相关效果 Demo 地址:https://github.com/seedotlee/AlipayIndexDemo

    ☕️ 赞助

    opened by Ccmi 6
  • scroll bounds 异常

    scroll bounds 异常

    提交bug前:

    • 请定位该bug是否由自身代码引发,当该bug模糊不清时,您应该继续思索;
    • 如果您发现该bug由KafkaRefresh引发,且您能修改源码解决,欢迎您提交解决方案或提交一个request,在此先表示感谢。

    提交bug必须包含下列要点:

    • iOS版本;12.2
    • KafkaRefresh版本(可查看cocoapods中提示的版本信息); 1.4.0
    • 请您务必给出详细的重现步骤。

    image image image

    uiscrollview 顶部贴着屏幕, 添加headerControl ,顶部会被占用45 的高度,contentview的frame通过reveal查看 x y 均为 0,headerControl 的frame为 0,-45,375,45。 代码如上。 可判断这个空白不是 scroll 自动调整高度的64

    image

    opened by SpectatorNan 6
  • 关于第一次调用 endRefreshingAndNoLongerRefreshingWithAlertText 时的疑问

    关于第一次调用 endRefreshingAndNoLongerRefreshingWithAlertText 时的疑问

    • iOS版本:12.3.1
    • 最新 Github Demo代码
    • 当我在 viewdidload 最后一行调用 endRefreshingAndNoLongerRefreshingWithAlertText 时,当前列表还可以继续上拉加载;请问这是正常的吗?因为我在 swift 里面网络请求上拉加载时第一次调用此方法也会出现还可以上拉加载; image
    opened by Ccmi 5
  • 刷新中的一个小问题

    刷新中的一个小问题

    比如下拉刷新,当我并没有下拉太多距离,也就是刷新的动画还未看见的时候,已经在执行刷新动作了,然后list回到初始位置,这个过程list移动的距离其实很小,这个地方我觉得不太好http://or7w4dvn2.bkt.clouddn.com/%E5%B1%8F%E5%B9%95%E5%BD%95%E5%88%B6.mov 具体看我录制的视频 这只是一个小小的建议~勿喷

    opened by biqinglin 3
  • Frozen refresh behaviour at start

    Frozen refresh behaviour at start

    When pulling refresh its frozen until you reach some offset. When reached, it starts animating. Is this by design? It seems to me that expected behaviour is when pulling, you see how refresh is already animating, even if it's 1 pixel on screen.

    I wanted to use this component, to not reinvent the wheel again, but this push me away. What do you think?

    opened by dannydaddy3 3
  • CollectionView 数据为空时,这个控件不好使。

    CollectionView 数据为空时,这个控件不好使。

    !!! 提交bug前:

    • 请定位该bug是否由自身代码引发,当该bug模糊不清时,您应该继续思索;
    • 如果您发现该bug由KafkaRefresh引发,且您能修改源码解决,欢迎您提交解决方案或提交一个request,在此先表示感谢。

    提交bug必须包含下列要点:

    • iOS版本;
    • KafkaRefresh版本(可查看cocoapods中提示的版本信息);
    • 请您务必给出详细的重现步骤。

    ☕️ 赞助

    opened by chenYtao 2
  • TableView contentOffset incorrect when load more many times

    TableView contentOffset incorrect when load more many times

    I run sample project with any type UITableView (Native, Circle, ..) I replaced [weakSelf.tableView.footRefreshControl endRefreshingWithAlertText:@"Loading " completion:^{ [weakSelf.tableView reloadData]; }]; to [weakSelf.tableView.footRefreshControl endRefreshing]; Ex: First, 6 rows. Load more 1: 12 rows Load more 2: 18 rows Load more 3: 24 rows Load more 4: 30 rows Load more 5: 36 rows (bottom off set on row 33, not index 30) Load more 6: 42 rows Load more 7: 48 rows (bottom off set on row 39, not index 42) (offset incorrect = 3) Load more 8: 54 rows (bottom off set on row 42, not index 48) (offset incorrect = 6) Load more 8: 60 rows (bottom off set on row 46, not index 54) (offset incorrect = 8) Load more 8: 66 rows (bottom off set on row 49, not index 60) (offset incorrect = 11) Load more 8: 72 rows (bottom off set on row 52, not index 66) (offset incorrect = 14) Load more 8: 78 rows (bottom off set on row 55, not index 72) (offset incorrect = 17)

    opened by hien352911 2
  • Refresh icons are slightly off the center to the right

    Refresh icons are slightly off the center to the right

    Thanks for this great lib. 謝謝你的美好事物

    I find that a refresh icon is slightly off the center to the right. 圖標略微偏離右側中心

    Same issue is here. 同樣的問題已經解決了 https://github.com/OpenFeyn/KafkaRefresh/issues/49

    Is this issue fixed already? 這個問題已經解決了嗎?

    If someone know how to fix it, please tell me how to fix it. 如果能告訴我是否有解決方案,我很高興

    Thanks 謝謝

    enhancement 
    opened by masuhara 2
  • swift 方式一初始化 header refresh control 为nil

    swift 方式一初始化 header refresh control 为nil

    提交bug前:

    • 请定位该bug是否由自身代码引发,当该bug模糊不清时,您应该继续思索;
    • 如果您发现该bug由KafkaRefresh引发,且您能修改源码解决,欢迎您提交解决方案或提交一个request,在此先表示感谢。

    提交bug必须包含下列要点:

    • iOS版本;
    • KafkaRefresh版本(可查看cocoapods中提示的版本信息);
    • 请您务必给出详细的重现步骤。

    image

    opened by SpectatorNan 2
  • bug : in a horizontal collection view the pull to refresh triggered from left to right not from top to bottom

    bug : in a horizontal collection view the pull to refresh triggered from left to right not from top to bottom

    提交bug前:

    • 请定位该bug是否由自身代码引发,当该bug模糊不清时,您应该继续思索;
    • 如果您发现该bug由KafkaRefresh引发,且您能修改源码解决,欢迎您提交解决方案或提交一个request,在此先表示感谢。

    提交bug必须包含下列要点:

    • iOS版本;12
    • KafkaRefresh版本(可查看cocoapods中提示的版本信息); latest
    • 请您务必给出详细的重现步骤。

    When using a horizontal collectionview with empty data, the refresh get triggered if pulled from left to right.

    opened by alouanemed 2
Owner
H. H. Hsiang
H. H. Hsiang
Animated "Pull To Refresh" Library for UIScrollView.

PullToBounce Animated "Pull To Refresh" Library for UIScrollView. You can add animated "pull to refresh" action to your UIScrollView, UITableView and

Takuya Okamoto 1.9k Dec 5, 2022
Custom animated pull-to-refresh that can be easily added to UIScrollView

PullToMakeSoup Custom animated pull-to-refresh that can be easily added to UIScrollView Check this article on our blog to know more details about anim

Yalantis 1.9k Dec 17, 2022
Fully customizable pull-to-refresh control inspired by Storehouse iOS app

CBStoreHouseRefreshControl What is it? A fully customizable pull-to-refresh control for iOS inspired by Storehouse iOS app ![screenshot1] (https://s3.

Suyu Zhang 4k Jan 6, 2023
Customizable pull-to-refresh control,written in pure Swift.

What is it This project is heavily inspired by CBStoreHouseRefreshControl which is Objective-C implemented. SurfingRefreshControl provides you a chanc

Peiwei 55 Aug 21, 2022
✳️ SwiftUI Pull to Refresh (for iOS 13 and iOS 14) package.

Refreshable ✳️ SwiftUI Pull to Refresh (for iOS 13 and iOS 14) package. See complementary article at SwiftUI Pull to Refresh (for iOS 13 and iOS 14).

Geri Borbás 21 Dec 2, 2022
A pull-down-to-refresh control for iOS that plays pong, originally created for the MHacks III iOS app

BOZPongRefreshControl A pull-down-to-refresh control for iOS that plays pong Installation It's on CocoaPods! Put pod 'BOZPongRefreshControl' in your P

Ben Oztalay 885 Dec 12, 2022
Elastic pull to refresh for iOS developed in Swift

DGElasticPullToRefresh Elastic pull to refresh compontent developed in Swift Inspired by this Dribbble post: Pull Down to Refresh by Hoang Nguyen Tuto

Danil Gontovnik 3.7k Jan 3, 2023
ESPullToRefresh is an easy-to-use component that give pull-to-refresh and infinite-scrolling implemention for developers.

ESPullToRefresh is an easy-to-use component that give pull-to-refresh and infinite-scrolling implemention for developers.

Vincent Li 1.7k Jan 8, 2023
Pull to refresh functionality for any ScrollView in SwiftUI!

SwiftUIPullToRefresh Pull to refresh is a common UI pattern, supported in UIKit via UIRefreshControl. (Un)surprisingly, it's also unavailable in Swift

Gordan Glavaš 185 Dec 29, 2022
Give pull-to-refresh & infinite scrolling to any UIScrollView with 1 line of code.

SVPullToRefresh + SVInfiniteScrolling These UIScrollView categories makes it super easy to add pull-to-refresh and infinite scrolling fonctionalities

Sam Vermette 4.9k Dec 1, 2022
One gesture, many actions. An evolution of Pull to Refresh.

MNTPullToReact MNTPullToReact is an extended evolution of the famous Pull to Refresh interaction. The main idea comes from a unique question: can the

Mention 777 Nov 20, 2022
Play BreakOut while loading - A playable pull to refresh view using SpriteKit

BreakOutToRefresh Play BreakOut while loading - A playable pull to refresh view using SpriteKit BreakOutToRefresh uses SpriteKit to add a playable min

Dominik Hauser 2.5k Dec 29, 2022
An easy way to use pull-to-refresh.

MJRefresh An easy way to use pull-to-refresh ?? ✍??Release Notes: more details Contents New Features Dynamic i18n Switching SPM Supported Swift Chaini

M了个J 13.7k Jan 6, 2023
GIFRefreshControl is a pull to refresh that supports GIF images as track animations.

GIFRefreshControl GIFRefreshControl is a pull to refresh that supports GIF images as track animations. Installation You have multiple choices here: Co

Kevin Delannoy 163 Oct 4, 2022
Pull-to-refresh animation in UICollectionView with a sticky header flow layout, written in Swift :large_orange_diamond:

ReplaceAnimation Implementation of Zee Young's Dribbble animation (https://dribbble.com/shots/2067564-Replace) Info I really liked Zee Young's animati

Alex Türk 957 Sep 13, 2022
An easy way to use pull-to-refresh

CRRefresh an easy way to use pull-to-refresh, If you want to customize its UI style, you just need conform the specified protocol. We will not regular

CRAnimation 957 Dec 13, 2022
PullToRefreshSwiftUI - Pull to refresh for SwiftUI

PullToRefreshSwiftUI Pull to refresh for SwiftUI. Usage with @State import Swift

Dmitry Kononchuk 1 Feb 28, 2022
LCPullRefresh - Use UIActivityIndicatorView to provide a pull-to-refresh function for UIScrollView.

LCPullRefresh Use UIActivityIndicatorView to provide a pull-to-refresh function for UIScrollView. Requirements iOS 8.0+ Xcode 11.0+ Usage Pull-up refr

LiuChang 7 Aug 5, 2022
Simple refresh control for iOS based on SpriteKit and Core Graphics

RainyRefreshControl Simple refresh control for iOS based on SpriteKit and Core Graphics. Project inspired by concept of Yup Nguyen Installation Instal

Onix-Systems 680 Dec 29, 2022