Git Product home page Git Product logo

amjpnmapview's Introduction

AMJpnMap

Pod Platform Pod License Pod Version Carthage Compatible Swift Package Manager compatible

It can display a simple map of Japan.

Demo

AMJpnMapView

Fig.1 Fig.2
map1 map2

AMJpnMapDetailView

map

map_detail

Usage

AMJpnMapView

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)
}

Customization

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

AMJpnMapDetailView

let jpnMapView = AMJpnMapDetailView(frame: view.bounds)

// customize here

view.addSubview(jpnMapView)

Customization

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)

Installation

CocoaPods

Add this to your Podfile.

pod 'AMJpnMap'

Carthage

Add this to your Cartfile.

github "adventam10/AMJpnMapView"

License

MIT

amjpnmapview's People

Contributors

adventam10 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

amjpnmapview's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.