GithubHelp home page GithubHelp logo

yothin / abfullscrollviewcontroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andresbrun/abfullscrollviewcontroller

0.0 2.0 0.0 4.47 MB

Custom ViewController to hide the toolbar when user makes scroll. Like Facebook, Safari, Twitter...

License: MIT License

abfullscrollviewcontroller's Introduction

ABFullScrollViewController

License MIT Build Status Build Platform Build Version

Subclass of ViewController that provide the behaviour of hide the toolbar when user makes scroll in a UITableView.

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like ABFullScrollViewController in your projects.

Podfile

pod "ABFullScrollViewController"

Installation

For install this component you only need to download the ABFullScrollViewController folder and copy it into your proyect. Then you need to inherate your view controller of ABFullScrollViewController:

#import "ABFullScrollViewController.h"

@interface ViewController : ABFullScrollViewController <UITableViewDataSource>

@end

In .m file you need to implements the classes that allow you to customize the behaviour, for example:

//The view that you want to set in toolbar view
-(UIView *) headerView:(UIView *)view forTableView:(UITableView *)tableView
{
    [view setFrame:CGRectMake(0, 0, self.tableView.frame.size.width, HEADER_STANDARD_HEIGHT)];
    
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0,
                                                               20/*status bar*/,
                                                               view.frame.size.width,
                                                               view.frame.size.height-20)];
    [label setFont:[UIFont fontWithName:@"Copperplate" size:20]];
    [label setTextColor:[UIColor blackColor]];
    [label setTextAlignment:NSTextAlignmentCenter];
    [label setText:@"ABFullScrollViewController"];
    [view addSubview:label];
        
    return view;
}

//The height of the toolbar view
-(float) headerHeightForTableView:(UITableView *)tableView
{
    return HEADER_STANDARD_HEIGHT;
}

//The color background color of the toolbar
- (UIColor *)toolbarBackgroundColor
{
    return [UIColor colorWithWhite:1.0 alpha:0.7];
}

//The minimum size that you want to show of the toolbar
- (float)minHeightWithoutHide
{
    return 20 /*status bar height*/;
}

For the last, you need to link in .xib file the tableViewDelegate, the toolbar and the tableView.

alt tag

Notes

  • This component uses scrollViewDidScroll:, scrollViewDidEndDragging: willDecelerate: and scrollViewDidEndDecelerating so if you need to implment it in you class remember to call the super of it ;).

  • This component doesn't work fine with Autolayout :(.

Examples

alt tag

License

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

abfullscrollviewcontroller's People

Contributors

andresbrun avatar bitdeli-chef avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.