Swift版本的CalloutView
2018-05-10 本文已影响11人
makemake
学完swift之后的第一个轮子🤤
简单的封装了一个Swift版本的 CalloutView,带小三角形的view,demo下载可以点这里
使用:
lazy var callView: MKCallOutView = {
var callView = MKCallOutView.init(frame: CGRect.init(x: 100, y: 100, width: 100, height: 50), direction: .right)
callView.bgColor = UIColor.red
return callView
}()
支持不同方向:
enum MKCallOutViewDirection {
/// -----------
/// / |
/// \ |
/// -----------
///
case left
/// -----------
/// | \
/// | /
/// -----------
///
case right
/// /\
/// ----- ----
/// | |
/// -----------
case top
/// -----------
/// | |
/// ---- -----
/// \/
case bottom
}
