[](https://travis-ci.org/Aleksey Getman/AGPullView)
To run the example project, clone the repo, and run pod install
from the Example directory first.
iOS 8.0 +
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 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'
Aleksey Getman, getmanag@gmail.com
AGPullView is available under the MIT license. See the LICENSE file for more info.