Lope
这是一个简单而优雅的SliderView,您可以在您的应用程序中轻松实现。
Lope在您的应用程序中实现时提供了一种平滑且易于使用的方法。它易于定制和修改。
安装
Cocoapods
pod install 'Lope'
Cartage
Coming Soon
使用示例
开发设置
在您的 UIViewController 中这样创建有意义的插入效应
import Lope
var lope: Lope!
在 viewDidLoad 中调用 lore,访问其他属性
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
lope = Lope(frame: CGRect.zero)
lope.delegate = self
lope.translatesAutoresizingMaskIntoConstraints = false
self.view.addSubview(lope)
setup()
}
以任何名称绑定你的函数
func setup() {
NSLayoutConstraint.activate([
// lope.centerXAnchor.constraint(equalTo: view.centerXAnchor, constant: 0),
// lope.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: 0),
lope.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 0),
lope.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0),
lope.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0),
lope.heightAnchor.constraint(equalToConstant: 64),
])
}
在完成时委托的方法
extension ViewController: LopeDelegate {
func startSlide(_ start: Bool) {
print("startSlide Lope")
}
func endSlide(_ end: Bool) {
print("endSlide Lope")
if end {
let alert = UIAlertController(title: "Lope", message: "Slide Done", preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
}
}
其他可访问的变量
sliderBackgroundColor: UIColor? = .black
baseViewBackgroundColor: UIColor? = .gray
titleTextColor: UIColor? = .black
发布历史
- 0.1.1
- 更改:更新文档(模块代码保持不变)
元数据
Adie Olalekan – @AdieOlami – [email protected]
在MIT许可下分发。有关更多信息,请参阅LICENSE
。
https://github.com/AdieOlami/Lope
贡献
- 进行Fork操作(https://github.com/AdieOlami/Lope/fork)
- 创建特性分支(
git checkout -b feature/fooBar
) - 提交您的更改(
git commit -am 'Add some fooBar'
) - 推送到分支(
git push origin feature/fooBar
) - 创建新的Pull Request