https://github.com/adventam10/amjpnmapview
It can display a simple map of Japan.
https://github.com/adventam10/amjpnmapview
ios japan japanese map swift swift4
Last synced: 4 months ago
JSON representation
It can display a simple map of Japan.
- Host: GitHub
- URL: https://github.com/adventam10/amjpnmapview
- Owner: adventam10
- License: mit
- Created: 2018-01-14T04:14:13.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-10-19T18:14:44.000Z (about 6 years ago)
- Last Synced: 2025-04-09T23:53:49.628Z (7 months ago)
- Topics: ios, japan, japanese, map, swift, swift4
- Language: Swift
- Homepage: https://qiita.com/am10/items/26de3242ee33b4bd4aae
- Size: 80.1 KB
- Stars: 17
- Watchers: 3
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AMJpnMap


[](http://cocoapods.org/pods/AMJpnMap)
[](https://github.com/Carthage/Carthage)
[](https://github.com/apple/swift-package-manager)
It can display a simple map of Japan.
## Demo
### AMJpnMapView
| Fig.1 | Fig.2 |
|---|---|
|||
### AMJpnMapDetailView


## Usage
### AMJpnMapView
```swift
let jpnMapView = AMJpnMapView(frame: view.bounds)
jpnMapView.delegate = self
// customize here
view.addSubview(jpnMapView)
```
Conform to the protocol in the class implementation.
```swift
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)
}
```
#### Customization
`AMJpnMapView` can be customized via the following properties.
```swift
@IBInspectable public var strokeColor: UIColor = .green
@IBInspectable public var fillColor: UIColor = .green
@IBInspectable public var strokeColorOkinawaLine: UIColor = .black
```
### AMJpnMapDetailView
```swift
let jpnMapView = AMJpnMapDetailView(frame: view.bounds)
// customize here
view.addSubview(jpnMapView)
```
#### Customization
`AMJpnMapDetailView` can be customized via the following properties.
```swift
@IBInspectable public var strokeColor: UIColor = .green
@IBInspectable public var fillColor: UIColor = .green
@IBInspectable public var strokeColorOkinawaLine: UIColor = .black
```
Set colors.
```swift
public func setStrokeColor(color: UIColor, prefecture: AMPrefecture)
public func setFillColor(color: UIColor, prefecture: AMPrefecture)
```
## Installation
### CocoaPods
Add this to your Podfile.
```ogdl
pod 'AMJpnMap'
```
### Carthage
Add this to your Cartfile.
```ogdl
github "adventam10/AMJpnMapView"
```
## License
MIT