rajaiosrg / KafkaRefresh

This library solves the problems encountered with the use of the popular pull-to-refresh library. And open interface easier to expand rich UI effects, and support for customize UI.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KafkaRefresh

Travis GitHub license CocoaPods Compatible platform language Email

中文文档

Screenshots

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

Overviews

Highly scalable, custom, multi-style refresh framework.

Comparison

The following comparison does not mean that the evaluation of these open source libraries to highlight the outstanding KafkaRefresh. EGO is the earliest refresh open source library, laid the foundation for later open source library provides a good idea. MJRefresh is the first to complete a complete system adaptation. Prior to MJRefresh, refresh the library is need to make some changes to meet the daily development needs. Here to pay tribute to these excellent open source library authors.

EGOTableViewPullRefresh SVPullToRefresh MJRefresh KafkaRefresh
Style choices
Allow interaction when refreshing
Continuous maintenance
Progress callback

Features

 
Feature Description
Support multi-style selection and custom KafkaRefresh has a number of refresh styles built in, and styles can be customized,expansion interface allows developers to integrate more rich UI effects.
Non-refresh state automatically hidden 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 Offset threshold can be customized, manually trigger refresh conditions; offset threshold is based on the height of the refresh control multiple, and must be greater than 1.0; otherwise invalid.
Support global configuration KafkaRefreshDefaults supports global setting style
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 iOS7 later UINavigationController automatically adjust scrollview contentOffset, KafkaRefresh also iOS 11 adaptation; when you manually set the value of contentInset, also need not worry about KafkaRefresh will affect the visual effects.
Support anti-content offset rolling refresh In general, we use the UITableView, especially UITableView need to use the drop-in refresh function, we rarely set SectionHeader. Unfortunately, if you use SectionHeader and integrate with UIRefreshControl or other third-party libraries, the refresh effect will be very ugly. The reason is that SectionHeader will follow the change of contentInset. The famous refresh library MJRefresh in dealing with this situation, the ScrollView manually scroll to the top, so you can solve the problem of SectionHeader dangling.
However, if your UITableView uses preprocessing or preloading techniques, then this is obviously not enough. When KafkaRefresh processes the situation, it determines according to the current position of the refresh control. If the user pull-down distance exceeds the height of the refresh control and the refresh control still can not be displayed on the screen, then only the refresh logic needs to be processed at this time, Without any refresh effect (without changing contentInset and contentOffset), even if the user suddenly slipping the top of the page, it will dynamically change the contentInset value, the user can still see the refresh effect, so deal with the data preloading Technical performance is very friendly.
Solve the refresh status grouping view hover problem When UITableView or UICollectionView has more than one group, and the height of the sectionView is not 0, the state of refresh will be half-empty. Since EGOTableViewPullRefresh, the refresh framework that tried to solve the problem started with MJRefresh, but unfortunately MJRefresh did not perfectly solve the problem (essentially because contentOffset does not change continuously). KafkaRefresh Avoids this problem even when swiping fast on a refresh.
Document coverage 100% You can see the use of all methods and classes in the header file.
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

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

1.Import header files
 #import "KafkaRefresh.h" 
2.Initialization
  • The first way
 [self.tableView bindRefreshStyle:KafkaRefreshStyleAnimatableArrow
						   fillColor:MainColor
						  atPosition:KafkaRefreshPositionHeader refreshHanler:^{
		 //.......
	}];

 [self.tableView bindRefreshStyle:KafkaRefreshStyleAnimatableArrow
						   fillColor:MinorColor
						  atPosition:KafkaRefreshPositionFooter
					   refreshHanler:^{
		 //.....
	}];
  • The second way
 KafkaArrowHeader * arrow = [[KafkaArrowHeader alloc] init];
 arrow.refreshHandler = ^{
	 //.....
 };
 self.tableView.headRefreshControl = arrow;
  • The third way(global configuration)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
	[[KafkaRefreshDefaults standardRefreshDefaults] setHeaderDefaultStyle:KafkaRefreshStyleAnimatableRing];
	return YES;
}

[self.tableView bindDefaultRefreshStyleAtPosition:KafkaRefreshPositionHeader refreshHanler:^{
		//.....
}];
3.Manual trigger refresh
 [self.tableView.headRefreshControl beginRefreshing];

 [self.tableView.footRefreshControl beginRefreshing];
4.End refresh
 [self.tableView.headRefreshControl endRefreshing];
 
 [self.tableView.footRefreshControl endRefreshing];
 
- (void)endRefreshingWithAlertText:(NSString *)text completion:(dispatch_block_t)completion;

 
- (void)endRefreshingAndNoLongerRefreshingWithAlertText:(NSString *)text;

Customize

Take KafkaheadRefreshControl as an example

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

 @end

.m

@implementation CustomHeader 

- (void)setupProperties{
   [super setupProperties];
   //Initialization properties
}

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

- (void)kafkaRefreshStateDidChange:(KafkaRefreshState)state{
   [super kafkaRefreshStateDidChange:state];
   
   switch (state) {
   	case KafkaRefreshStateNone:{
   		break;
   	}
   	case KafkaRefreshStateScrolling:{
   		break;
   	}
   	case KafkaRefreshStateReady:{
   		break;
   	}
   	case KafkaRefreshStateRefreshing:{ 
   		break;
   	}
   	case KafkaRefreshStateWillEndRefresh:{ 
   		break;
   	}
   }
}
@end

Precautions

  • Please update the latest version;
  • After iOS 11, if you use estimatedRowHeight and the estimatedRowHeight height is too far from the true height, UITableView repeated refreshes may occur before version 0.8.3, which has been resolved since version 0.8.3 (iOS bug)

Communication

  1. If you need help,please email xorshine@icloud.com.
  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.

About

This library solves the problems encountered with the use of the popular pull-to-refresh library. And open interface easier to expand rich UI effects, and support for customize UI.

License:MIT License


Languages

Language:Objective-C 97.3%Language:Ruby 2.7%