AGPullView
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.
Usage
First, import AGPullViewConfigurator For SWIFT - you should import AGPullViewConfigurator in bridging header first to use AGPullView
import "AGPullViewConfigurator.h"
Initialization
Just use standart initialization
Objective-C
self.configurator = [AGPullViewConfigurator new];
SWIFT
let configurator = AGPullViewConfigurator()
Setting up
Then setup AGPullView for your view like so (white preset color scheme - default):
Objective-C
[self.configurator setupPullViewForSuperview:self.view];
SWIFT
self.configurator.setupPullView(forSuperview: self.view)
Or you can setup AGPullView with one of preset color schemes
Objective-C
[self.configurator setupPullViewForSuperview:self.view colorScheme:ColorSchemeTypeGrayTransparent];
SWIFT
self.configurator.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.configurator handleTouchesBegan:touches];
}
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[self.configurator handleTouchesMoved:touches];
}
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[self.configurator handleTouchesEnded:touches];
}
SWIFT
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
self.configurator.handleTouchesBegan(touches)
}
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
self.configurator.handleTouchesMoved(touches)
}
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
self.configurator.handleTouchesEnded(touches)
}
Great! Now your AGPullView is ready for using!
Delegation
Use AGconfiguratorDelegate methods for full control
self.configurator.delegate
Customization
You can fill AGPullView with your content by accessing property contentView like so:
self.configurator.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.configurator fullfillContentViewWithView:tableView];
SWIFT
self.configurator.fullfillContentView(with: table)
You can turn on/off blur effect like so:
- ON
Objective-C
[self.configurator enableBlurEffectWithBlurStyle:UIBlurEffectStyleLight];
SWIFT
self.configurator.enableBlurEffect(withBlurStyle: .dark)
- OFF
Objective-C
[self.configurator undoBlurEffect];
SWIFT
self.configurator.undoBlurEffect()
Animation control is provided with these useful methods:
Objective-C
self.configurator.enableShowingWithTouch = YES;
self.configurator.enableHidingWithTouch = YES;
[self.configurator hideAnimated:YES];
[self.configurator showAnimated:YES];
SWIFT
self.configurator.enableShowingWithTouch = true;
self.configurator.enableHidingWithTouch = true;
self.configurator.hide(animated: true)
self.configurator.hide(animated: true)
There is batch of useful settings for your AGPullView instance:
self.configurator.colorSchemeType
self.configurator.animationDuration
self.configurator.blurStyle
self.configurator.needBounceEffect
self.configurator.percentOfFilling
AGPullView uses KVO, so some performance can be changed in runtime with theese properties
self.configurator.enableShowingWithTouch
self.configurator.enableHidingWithTouch
self.configurator.blurStyle
self.configurator.colorSchemeType
And here is a demo of random changing properties 'blurStyle' and 'colorSchemeType'
Author
Aleksey Getman, getmanag@gmail.com
License
AGPullView is available under the MIT license. See the LICENSE file for more info.