Skip to content

Commit

Permalink
Update Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesdouble committed Jul 13, 2017
1 parent 30fe068 commit 714eb48
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 11 deletions.
Binary file not shown.
20 changes: 13 additions & 7 deletions JDRealHeatMap/JDSwiftHeatMap/JDRealHeatMap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class JDSwiftHeatMap:MKMapView
var missionController:JDHeatMapMissionController!
var indicator:UIActivityIndicatorView?
//
var showindicator:Bool = true{
public var showindicator:Bool = true{
didSet{
if(!showindicator)
{
Expand Down Expand Up @@ -67,6 +67,10 @@ public class JDSwiftHeatMap:MKMapView

public func refresh()
{
if(self.showindicator)
{
self.indicator?.startAnimating()
}
missionController.ExecuteRefreshMission()
}

Expand Down Expand Up @@ -97,14 +101,16 @@ public class JDSwiftHeatMap:MKMapView
indicator = UIActivityIndicatorView(activityIndicatorStyle: .whiteLarge)
indicator?.translatesAutoresizingMaskIntoConstraints = false
self.addSubview(indicator!)
let sizeWidth = NSLayoutConstraint(item: indicator!, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 0.0, constant: 100)
let sizeHeight = NSLayoutConstraint(item: indicator!, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 0.0, constant: 100)
let rightCon = NSLayoutConstraint(item: indicator!, attribute: .trailing, relatedBy: .equal, toItem: self, attribute: .trailing, multiplier: 1.0, constant: 0)
let BottomCon = NSLayoutConstraint(item: indicator!, attribute: .bottom, relatedBy: .equal, toItem: self, attribute: .bottom, multiplier: 1.0, constant: 0)
let sizeWidth = NSLayoutConstraint(item: indicator!, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 0.0, constant: 60)
let sizeHeight = NSLayoutConstraint(item: indicator!, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 0.0, constant: 60)
let CenterX = NSLayoutConstraint(item: indicator!, attribute: .centerX, relatedBy: .equal, toItem: self, attribute: .centerX, multiplier: 1.0, constant: 0)
let CenterY = NSLayoutConstraint(item: indicator!, attribute: .centerY, relatedBy: .equal, toItem: self, attribute: .centerY, multiplier: 1.0, constant: 0)

//let rightCon = NSLayoutConstraint(item: indicator!, attribute: .trailing, relatedBy: .equal, toItem: self, attribute: .trailing, multiplier: 1.0, constant: 0)
//let BottomCon = NSLayoutConstraint(item: indicator!, attribute: .bottom, relatedBy: .equal, toItem: self, attribute: .bottom, multiplier: 1.0, constant: 0)
indicator?.addConstraints([sizeWidth,sizeHeight])
self.addConstraints([rightCon,BottomCon])
self.addConstraints([CenterX,CenterY])
self.updateConstraints()
indicator?.startAnimating()
}
}

Expand Down
2 changes: 1 addition & 1 deletion JDRealHeatMap/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ViewController: UIViewController {
super.viewDidLoad()
addRandomData()

map = JDSwiftHeatMap(frame: mapsView.frame, delegate: self, maptype: .FlatDistinct)
map = JDSwiftHeatMap(frame: mapsView.frame, delegate: self, maptype: .RadiusDistinct)
map?.delegate = self
mapsView.addSubview(map!)
}
Expand Down
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ You can easily make a highly customized HeatMap.
![Alt text](https://raw.githubusercontent.com/jamesdouble/JDSwiftHeatMap/master/Readme_img/jdheatmapDemo.png?token=AJBUU1UA_L_wx5f_E3iRsaUGAh_xg3pCks5Zb1yIwA%3D%3D)

# Installation
* Cocoapods

```
pod 'JDSWiftHeatMap'
```


# Usage
Expand Down Expand Up @@ -82,10 +86,22 @@ There are two delegate you need to pay close.
```
*The default radius in km is 100KM.*

### Notice

More data will cause **large memory using**, should be notice.

## Setting

1. public func setType(type:JDMapType)

change the display type, it will refresh automatically.

2. public func refresh()

Call this function when data changed.

3. public var showindicator:Bool

Set the loading indicator showing or not.

0 comments on commit 714eb48

Please sign in to comment.