Skip to content

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

License

Notifications You must be signed in to change notification settings

guidosette/GFRefreshControl

Repository files navigation

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published