Arrows 是一个动画自定义视图,用于表示三种不同的箭头状态:上/下/中
只需在你想用箭头指示器绘制的类中,通过 IB 设置 ArrowView
。或者直接在代码中实例化 ArrowView
类。 它基于 UIBezierPath,因此尺寸由视图框架定义,无需担心分辨率,它看起来会很完美。
在你的 ViewController 中,你可以使用 update
函数来改变箭头的状态
class YourViewController: UIViewController {
@IBOutlet weak var arrow: ArrowPanel!
override func viewDidLoad() {
super.viewDidLoad()
// .up, .down, .middle
arrow.update(to: .middle, animated: true)
}
}
你可以在 ArrowView
中找到更多选项
/// Get the current position
fileprivate(set) var arrowPosition: Position = .middle
/// Animation duration between arrow states (accessible from IB)
@IBInspectable open var arrowAnimationDuration: Double = 0.30
/// Set arrow color (accessible from IB)
@IBInspectable open var arrowColor: UIColor = .black
Arrows
的完美搭档是 Panels,快来看看吧! ✨
在你的 Podfile
中添加这行代码:pod "Arrows"
在你的 Cartfile
中添加这行代码:github "antoniocasero/Arrows"
项目由 Antonio Casero 创建 (Twitter 上的 @acaserop).