MEVFloatingButton is An iOS drop-in UITableView, UICollectionView, UIScrollView superclass category for showing a customizable floating button on top of it.
The features are:
* Multiple animation types.
* Different display modes.
* Different screen positions.
* Customizable button icon.
* Multiple delegate methods.
Installation
CocoaPods
MEVFloatingButton is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
[ruby]
pod ‘MEVFloatingButton’
[/ruby]
Manual
Simply include UIScrollView+FloatingButton.h and UIScrollView+FloatingButton.m from /Pod/Classes/ folder in your App’s Xcode project.
How to use
Step 1
[objc]
#import "UIScrollView+FloatingButton.h"
[/objc]
Step 2
Add delegate and delegate methods.
[objc]
@interface ViewController ()
#pragma mark – MEScrollToTopDelegate Methods
– (void)floatingButton:(UIScrollView *)scrollView didTapButton:(UIButton *)button;
– (void)floatingButtonWillAppear:(UIScrollView *)scrollView;
– (void)floatingButtonDidAppear:(UIScrollView *)scrollView;
– (void)floatingButtonWillDisappear:(UIScrollView *)scrollView;
– (void)floatingButtonDidDisappear:(UIScrollView *)scrollView;
[/objc]
Step 3
Create a `MEVFloatingButton`object.
[objc]
MEVFloatingButton *button = [[MEVFloatingButton alloc] init];
button.animationType = MEVFloatingButtonAnimationFromBottom;
button.displayMode = MEVFloatingButtonDisplayModeWhenScrolling;
button.position = MEVFloatingButtonPositionBottomCenter;
button.image = [UIImage imageNamed:@"Icon0"];
button.imageColor = [UIColor groupTableViewBackgroundColor];
button.backgroundColor = [UIColor darkGrayColor];
button.outlineColor = [UIColor darkGrayColor];
button.outlineWidth = 0.0f;
button.imagePadding = 20.0f;
button.horizontalOffset = 20.0f;
button.verticalOffset = -30.0f;
button.rounded = YES;
button.hideWhenScrollToTop = YES;
[/objc]
Set the object to your UIScrollView/UITableView/UICollectionView.
[objc]
[self.tableView setFloatingButtonView:button];
[/objc]
Set the delegate.
[objc]
[self.tableView setFloatingButtonDelegate:self]
[/objc]
For more information:
Can i use this control on UIScrollview if it has larger content size and need to scroll to show more content in it OR it only works on UITableview only?