Skip to content

Files

Latest commit

b805ee4 · Sep 26, 2016

History

History
200 lines (148 loc) · 4.76 KB

README.md

File metadata and controls

200 lines (148 loc) · 4.76 KB

AGPullView

[![CI Status](http://img.shields.io/travis/Aleksey Getman/AGPullView.svg?style=flat)](https://travis-ci.org/Aleksey Getman/AGPullView) Version License Platform

Example

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

Requirements

iOS 8.0 +

Installation

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

pod "AGPullView"

#Demo

Short demo of AGPullView performance.

Demo

#Usage

First, import AGPullViewConfigurer For SWIFT - you should import AGPullViewConfigurer in bridging header first to use AGPullView

import "AGPullViewConfigurer.h"

##Initialization

Just use standart initialization

Objective-C

self.configurer = [AGPullViewConfigurer new];

SWIFT

let configurer = AGPullViewConfigurer()

Then setup AGPullView for your view like so (white preset color scheme - default):

Objective-C

[self.configurer setupPullViewForSuperview:self.view];

SWIFT

self.configurer.setupPullView(forSuperview: self.view)

Or you can setup AGPullView with one of preset color schemes

Objective-C

[self.configurer setupPullViewForSuperview:self.view colorScheme:ColorSchemeTypeGrayTransparent];

SWIFT

self.configurer.setupPullView(forSuperview: self.view, colorScheme:ColorSchemeTypeDarkTransparent)

Then you also should override several your superview's UIResponder methods with calling AGPullView methods there:

Objective-C

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self.configurer handleTouchesBegan:touches];
}

- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self.configurer handleTouchesMoved:touches];
}

- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self.configurer handleTouchesEnded:touches];
}

SWIFT

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
    self.configurer.handleTouchesBegan(touches)
}

override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
    self.configurer.handleTouchesMoved(touches)
}

override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
    self.configurer.handleTouchesEnded(touches)
}

Great! Now your AGPullView is ready for using!

##Settings

Use AGConfigurerDelegate methods for full control

self.configurer.delegate

You can fill AGPullView with your content by accessing property contentView like so:

self.configurer.contentView

There is also a convenient method for filling whole content view with your content (ex. UITableView). It will also create necessary constraints for you.

Objective-C

[self.configurer fullfillContentViewWithView:tableView];

SWIFT

self.configurer.fullfillContentView(with: table)

You can turn on/off blur effect like so:

ON

Objective-C

[self.configurer enableBlurEffectWithBlurStyle:UIBlurEffectStyleLight];
self.configurer.enableBlurEffect(withBlurStyle: .dark)

OFF

Objective-C

[self.configurer undoBlurEffect];
self.configurer.undoBlurEffect()

Animation control is provided with these useful methods:

Objective-C

self.configurer.enableShowingWithTouch = YES;
self.configurer.enableHidingWithTouch = YES;

[self.configurer hideAnimated:YES];
[self.configurer showAnimated:YES];
self.configurer.enableShowingWithTouch = YES;
self.configurer.enableHidingWithTouch = YES;

self.configurer.hide(animated: YES)
self.configurer.hide(animated: YES)

There is batch of useful settings for your AGPullView instance:

self.configurer.colorSchemeType

self.configurer.animationDuration

self.configurer.blurStyle

self.configurer.needBounceEffect

self.configurer.percentOfFilling

AGPullView uses KVO, so some performance can be changed in runtime with theese properties

self.configurer.enableShowingWithTouch
self.configurer.enableHidingWithTouch
self.configurer.blurStyle
self.configurer.colorSchemeType

And here is a demo of random changing properties 'blurStyle' and 'colorSchemeType' Demo

Author

Aleksey Getman, getmanag@gmail.com

License

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