It can display a simple map of Japan.
Fig.1 | Fig.2 |
---|---|
let jpnMapView = AMJpnMapView(frame: view.bounds)
jpnMapView.delegate = self
// customize here
view.addSubview(jpnMapView)
Conform to the protocol in the class implementation.
func jpnMapView(_ jpnMapView: AMJpnMapView, didSelectAtRegion region: AMRegion) {
// use selected region here
// example 1 (like Fig.1)
jpnMapView.setStrokeColor(color: .black, region: region)
jpnMapView.setScale(scale: 3.0, region: region)
// example 2 (like Fig.2)
jpnMapView.setFillColor(color: .red, region: region)
jpnMapView.setStrokeColor(color: .red, region: region)
}
func jpnMapView(_ jpnMapView: AMJpnMapView, didDeselectAtRegion region: AMRegion) {
// use deselected region here
// example 1 (like Fig.1)
jpnMapView.setStrokeColor(color: .green, region: region)
jpnMapView.setScale(scale: 1.0, region: region)
// example 2 (like Fig.2)
jpnMapView.setFillColor(color: .green, region: region)
jpnMapView.setStrokeColor(color: .green, region: region)
}
AMJpnMapView
can be customized via the following properties.
@IBInspectable public var strokeColor: UIColor = .green
@IBInspectable public var fillColor: UIColor = .green
@IBInspectable public var strokeColorOkinawaLine: UIColor = .black
let jpnMapView = AMJpnMapDetailView(frame: view.bounds)
// customize here
view.addSubview(jpnMapView)
AMJpnMapDetailView
can be customized via the following properties.
@IBInspectable public var strokeColor: UIColor = .green
@IBInspectable public var fillColor: UIColor = .green
@IBInspectable public var strokeColorOkinawaLine: UIColor = .black
Set colors.
public func setStrokeColor(color: UIColor, prefecture: AMPrefecture)
public func setFillColor(color: UIColor, prefecture: AMPrefecture)
Add this to your Podfile.
pod 'AMJpnMap'
Add this to your Cartfile.
github "adventam10/AMJpnMapView"
MIT