GitHunt
GU

guidosette/GFRefreshControl

Custom and customizable refresh control animation for ScrollView and TableView. Custom and customizable refresh control animation for ScrollView and TableView.

GFRefreshControl

CI Status
Version
License
Platform

Example

Alt Text

Custom and customizable refresh control animation for ScrollView and TableView.
Custom and customizable refresh control animation for ScrollView and TableView.
You can use your custom image and change backgrounf, image colors.

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

GFRefreshControl is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'GFRefreshControl'

How to use

- (void)initRefreshControl:(UIScrollView*)scrollView {
	refreshControl = [[GFRefreshImageControl alloc] initWithTableView:scrollView protocol:self selector:@selector(callRequest) target:self];

	[scrollView addSubview:refreshControl];
	
	// customizable
	[refreshControl setImage:[UIImage imageNamed:@"test"]];
	[refreshControl setFillImageBackgroundColor:[UIColor groupTableViewBackgroundColor]];
	[refreshControl setFillColor:[UIColor redColor]];
	//    [refreshControl setBackgroundColor:[UIColor groupTableViewBackgroundColor]];
}

- (void)callRequest {
	NSLog(@"callRequest");
	dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 2 * NSEC_PER_SEC);
	dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
		[self->refreshControl endRefreshing];
	});
}

- (void)viewDidLayoutSubviews {
	[super viewDidLayoutSubviews];
	[refreshControl updateTableBounds:_scrollView.frame.size];
}

#pragma mark - GFRefreshControlProtocol

- (UIScrollView *)getScrollViewForRefreshControl {
	return _scrollView;
}

Author

guidosette, guido.fanfani7@gmail.com

License

GFRefreshControl is available under the MIT license. See the LICENSE file for more info.

Languages

Objective-C92.2%Ruby7.8%

Contributors

MIT License
Created October 11, 2019
Updated October 14, 2019
guidosette/GFRefreshControl | GitHunt