An iOS drop-in UITableView, UICollectionView and UIScrollView superclass category for showing a customizable floating button on top of it.

Overview

MEVFloatingButton

An iOS drop-in UITableView, UICollectionView, UIScrollView superclass category for showing a customizable floating button on top of it.

BuddyBuild Version License Platform Language

MEVFloatingButton

Features

  • Multiple animation types.
  • Different display modes.
  • Different screen positions.
  • Customizable button icon.
  • Multiple delegate methods.

Demo

Demo App

Usage

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

Requirements

Requires iOS SDK version > 8.0

Installation


CocoaPods

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

pod 'MEVFloatingButton'
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
#import "UIScrollView+FloatingButton.h"
Step 2

Add datasource and delegate methods.

@interface ViewController () <MEVFloatingButtonDelegate>
#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;
Step 3

Create a MEVFloatingButtonobject.

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;

Set the object to your UIScrollView/UITableView/UICollectionView.

[self.tableView setFloatingButtonView:button];

Set the delegate.

[self.tableView setFloatingButtonDelegate:self]

Sample Project

For more info check the Examples project. Everything is there.

Change Log

See Changelog.md

Author

Manuel Escrig Ventura, @manuelescrig

Credits

Icons made by Elegant Themes from www.flaticon.com

License

MEVFloatingButton is available under the MIT license. See License.md

Comments
  • Not working in child view controller

    Not working in child view controller

    I'm having problems getting MEVFloatingButton to work, probably due to my view setup. I have a parent view controller that adds a childviewcontroller like so:

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; OverviewGridController *mainView = [storyboard instantiateViewControllerWithIdentifier:@"OverviewGridController"];
    [self addChildViewController:mainView]; [self.view addSubview:mainView.view]; [mainView didMoveToParentViewController:self];

    The child view controller has a collectionview on which I want to place the floating button.

    I have tried to add it from the parent like this:

    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; OverviewGridController *mainView = [storyboard instantiateViewControllerWithIdentifier:@"OverviewGridController"];
    MEVFloatingButton *button = [[MEVFloatingButton alloc] init]; button.animationType = MEVFloatingButtonAnimationNone; button.displayMode = MEVFloatingButtonDisplayModeWhenScrolling; button.position = MEVFloatingButtonPositionBottomRight; button.image = [UIImage imageNamed:@"icon_aplus"]; button.imageColor = [UIColor colorWithRed:44/255.0f green:62/255.0f blue:80/255.0f alpha:1]; button.backgroundColor = [UIColor colorWithRed:65/255.0f green:131/255.0f blue:215/255.0f alpha:1]; button.outlineColor = [UIColor colorWithRed:44/255.0f green:62/255.0f blue:80/255.0f alpha:1]; button.outlineWidth = 3.0f; button.imagePadding = 20.0f; button.horizontalOffset = -30.0f; button.verticalOffset = -30.0f; button.rounded = YES; button.shadowColor = [UIColor lightGrayColor]; button.shadowOffset = CGSizeMake(3, 3); button.shadowOpacity = 0.6f; button.shadowRadius = 3.0f;

    [mainView setFloatingButtonView:button]; [mainView setFloatingButtonDelegate:self];

    [self addChildViewController:mainView]; [self.view addSubview:mainView.view]; [mainView didMoveToParentViewController:self];

    Button is not added and delegate methods are not responding.

    I have also tried to add it in the child in it's viewdidload. Button is not added BUT when setting button.displayMode = MEVFloatingButtonDisplayModeWhenScrolling (and only then) the floatingButtonDidDisappear delegate method is triggered when the view is loaded.

    Would really appreciate if someone can point me in the right direction.

    bug 
    opened by obia75 8
  • Rotate MEVFloatingButton

    Rotate MEVFloatingButton

    Hi,

    I want to give rotation animation into MEVFloatingButton. So I tried with this,

    - (void)floatingButton:(UIScrollView *)scrollView didTapButton:(UIButton *)button {
        [UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveLinear animations:^{
            [self.button setTransform:CGAffineTransformRotate(self.button.transform, M_PI)];
        }completion:^(BOOL finished){
            NSLog(@"completed animating");
        }];
    }
    

    On a standard UIButton, it will rotate its button with button's center. But with MEVFloatingButton, it rotated like a mars with sun as it center. I mean, MEVFloatingButton is the mars.

    Is there any solution? Thank you!

    opened by riyanpratamap 1
  • Button disappears when after dismissing a modal view

    Button disappears when after dismissing a modal view

    I am using the button to trigger a UIImagePickerController to appear. After selecting or capturing an image, the modal is removed from the view, but the button has been as well. Simply setting button.hidden = false brings the button back, but it's annoying behavior to have to call that every time you return to the view controller containing the button.

    Steps to replicate:

    • Add button to tableView
    • Present a UIImagePickerController
    • Dismiss UIImagePickerController
    bug 
    opened by pushchris 1
  • app crashing in mev_dealloc

    app crashing in mev_dealloc

    I added the project according to provided steps but it is continuously crashing when it reaches to try section of mev_dealloc method. Can you check the same please cause even your sample app crashes over there. I tried even commenting the method call location, but still the app runs but the button doesn't appears at all.

    I want to implement the example2 project in my app. Please suggest me the solution.

    Is there any step that I am missing out of it? IS it necessary to install the pod in order to run add this in my project?

    help wanted 
    opened by chatterjeesubhojit 8
  • TableView Keyboard Appear Issue

    TableView Keyboard Appear Issue

    Hi, Once keyboard appeared and the keyboard will overlay the MEVFloatingButton. Normally, i think it could be following the keyboard moving up. Thanks

    enhancement help wanted 
    opened by Ferrick90 1
Releases(1.1.2)
Owner
Manuel Escrig
A Renaissance Man. Software Engineer
Manuel Escrig
Netflix and App Store like UITableView with UICollectionView, written in pure Swift 4.2

GLTableCollectionView Branch Status master develop What it is GLTableCollectionView is a ready to use UITableViewController with a UICollectionView fo

Giulio 708 Nov 17, 2022
Incremental update tool to UITableView and UICollectionView

EditDistance is one of the incremental update tool for UITableView and UICollectionView. The followings show how this library update UI. They generate

Kazuhiro Hayashi 90 Jun 9, 2022
🚴 A declarative library for building component-based user interfaces in UITableView and UICollectionView.

A declarative library for building component-based user interfaces in UITableView and UICollectionView. Declarative Component-Based Non-Destructive Pr

Ryo Aoyama 1.2k Jan 5, 2023
A generic small reusable components for data source implementation for UITableView/UICollectionView in Swift.

GenericDataSource A generic small reusable components for data source implementation for UITableView/UICollectionView written in Swift. Features Basic

null 132 Sep 8, 2021
ZHTCView - UITableview & UICollectionView

ZHTCView 这是一个使用Block替换代理的UITableview & UICollectionView。 使用方法如下: - (DSTableView *)tableView { if (!_tableView) { _tableView = DSTableView.

黑酒一 0 Jan 10, 2022
💾 A library for backporting UITableView/UICollectionViewDiffableDataSource.

DiffableDataSources ?? A library for backporting UITableView/UICollectionViewDiffableDataSource powered by DifferenceKit. Made with ❤️ by Ryo Aoyama I

Ryo Aoyama 762 Dec 28, 2022
Easier way to represent the structure of UITableView.

Shoyu Shoyu is a library written in Swift to represent UITableView data structures. Shoyu means Soy Sauce in Japanese. Usage Create single section and

yukiasai 278 Apr 14, 2022
A data-driven UICollectionView framework for building fast and flexible lists.

A data-driven UICollectionView framework for building fast and flexible lists. Main Features ?? Never call performBatchUpdates(_:, completion:) or rel

Instagram 12.5k Jan 1, 2023
Collapse and expand UICollectionView sections with one method call.

This library provides a custom UICollectionView that allows to expand and collapse sections. Provides a simple API to manage collection view appearanc

Touchlane 172 Dec 26, 2022
Protocol-oriented UICollectionView management, powered by generics and associated types.

DTCollectionViewManager Features Powerful mapping system between data models and cells, headers and footers Automatic datasource and interface synchro

Denys Telezhkin 308 Jan 6, 2023
UICollectionView layout for presenting of the overlapping cells.

StickyCollectionView UICollectionView layout for presenting of the overlapping cells. Objective-C version here Checkout demo Overview Installation Man

Bogdan Matveev 325 Oct 11, 2022
Reimagining UICollectionView

CollectionKit Reimagining UICollectionView A modern Swift framework for building composable data-driven collection view. Migration Guide v2.0 Features

SoySauceLab 4.3k Dec 27, 2022
Conv smart represent UICollectionView data structure more than UIKit.

Conv Conv smart represent UICollectionView data structure more than UIKit. Easy definition for UICollectionView DataSource and Delegate methods. And C

bannzai 157 Nov 25, 2022
CollectionView - UICollectionView using UICollectionViewCompositionalLayout

CollectionView UICollectionView using UICollectionViewCompositionalLayout create

null 0 Jan 11, 2022
CollectionViewSegmentedControl - Scrollable UISegmentedControl built using a UICollectionView

CollectionViewSegmentedControl Installation CocoaPods Download CocoaPods Run 'Po

James Sedlacek 7 Nov 24, 2022
Conv smart represent UICollectionView data structure more than UIKit.

Conv Conv smart represent UICollectionView data structure more than UIKit. Easy definition for UICollectionView DataSource and Delegate methods. And C

bannzai 155 May 12, 2022
A modest attempt to port UICollectionView to SwiftUI.

LazyCollectionView A modest attempt to port UICollectionView to SwiftUI. Table of Contents Description Requirements Installation Usage Components Impr

Unsplash 109 Dec 27, 2022
This component allows for the transfer of data items between collection views through drag and drop

Drag and Drop Collection Views Written for Swift 4.0, it is an implementation of Dragging and Dropping data across multiple UICollectionViews. Try it

Michael Michailidis 508 Dec 19, 2022
Spreadsheet CollectionViewLayout in Swift. Fully customizable. 🔶

SwiftSpreadsheet Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Swift 5.0 Inst

Wojtek Kordylewski 637 Dec 30, 2022