要运行示例项目,首先克隆仓库,然后在 Example 目录中运行 pod install
iOS 8.0+
AGPullView 通过 CocoaPods 提供。要安装它,只需简单地将以下行添加到您的 Podfile 中
pod "AGPullView"
AGPullView 性能的简短演示。
首先,导入 AGPullViewConfigurator For SWIFT - 您应该首先在桥接头中导入 AGPullViewConfigurator 以使用 AGPullView
import "AGPullViewConfigurator.h"
只需使用标准初始化
Objective-C
self.configurator = [AGPullViewConfigurator new];
Swift
let configurator = AGPullViewConfigurator()
然后将 AGPullView 设置为您的视图,如下所示(白色预设颜色方案 - 默认)
Objective-C
[self.configurator setupPullViewForSuperview:self.view];
Swift
self.configurator.setupPullView(forSuperview: self.view)
或者您可以使用预设的颜色方案之一来设置 AGPullView
Objective-C
[self.configurator setupPullViewForSuperview:self.view colorScheme:ColorSchemeTypeGrayTransparent];
Swift
self.configurator.setupPullView(forSuperview: self.view, colorScheme:ColorSchemeTypeDarkTransparent)
然后,您应该通过调用 AGPullView 方法来重写您 superview 的几个 UIResponder 方法
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)
}
太好了!现在您的 AGPullView 已经可以使用!
使用 AGconfiguratorDelegate 方法进行完全控制
self.configurator.delegate
您可以通过访问属性 contentView 来填充 AGPullView 中的内容
self.configurator.contentView
还有一个方便的方法可以填充整个内容视图(例如UITableView)中的内容。它还将为您创建必要的约束。
Objective-C
[self.configurator fullfillContentViewWithView:tableView];
Swift
self.configurator.fullfillContentView(with: table)
您可以通过以下方式打开/关闭模糊效果
开
Objective-C
[self.configurator enableBlurEffectWithBlurStyle:UIBlurEffectStyleLight];
self.configurator.enableBlurEffect(withBlurStyle: .dark)
关
Objective-C
[self.configurator undoBlurEffect];
self.configurator.undoBlurEffect()
动画控制通过以下有用方法提供
Objective-C
self.configurator.enableShowingWithTouch = YES;
self.configurator.enableHidingWithTouch = YES;
[self.configurator hideAnimated:YES];
[self.configurator showAnimated:YES];
self.configurator.enableShowingWithTouch = YES;
self.configurator.enableHidingWithTouch = YES;
self.configurator.hide(animated: YES)
self.configurator.hide(animated: YES)
对于您的 AGPullView 实例有一系列有用的设置
self.configurator.colorSchemeType
self.configurator.animationDuration
self.configurator.blurStyle
self.configurator.needBounceEffect
self.configurator.percentOfFilling
AGPullView 使用 KVO,因此在运行时可以通过这些属性更改一些性能
self.configurator.enableShowingWithTouch
self.configurator.enableHidingWithTouch
self.configurator.blurStyle
self.configurator.colorSchemeType
下面是一个关于随机更改属性 'blurStyle' 和 'colorSchemeType' 的演示
亚历克谢·格特曼,[email protected]
AGPullView 可在 MIT 许可证下使用。有关更多信息,请参阅 LICENSE 文件。