Latest 1.0.2
Homepage https://github.com/grethi/CHGMapViewScale
License MIT
Platforms ios 7.0, requires ARC
Dependencies BlocksKit, GoogleMaps
Frameworks UIKit, GoogleMaps
Authors

Version
License
Platform

Restrictions

This pod will only work with GoogleMaps < 2.0.0. Tested on iOS 7 to iOS 10.3.

Example

Screenshot of example CHGMapViewController

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

This pod has dependencies to the GoogleMaps framework and the pod BlocksKit.

Installation

CHGMapViewScale is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "CHGMapViewScale"

Usage

There are two different ways to use the scale:

  • directly (Example: GMSMapViewController):
// create a new scale for a specific GMSMapView
_mapViewScale = [[CHGMapViewScale alloc] initWithMapView:_mapView];
// customize the scale
_mapViewScale.scalePosition = CHGMapViewScalePositionTopRight;
_mapViewScale.topAdjustment = CGRectGetHeight(self.navigationController.navigationBar.bounds) + 30.f;
// update the scale
[_mapViewScale update];
  • or wrapped in CHGMapView (Example: CHGMapViewController)
    
    // create a new CHGMapView based on GMSMapView. The scale is automatically available but invisible.
    _mapView = [CHGMapView mapWithFrame:CGRectZero camera:camera];
    self.view = _mapView;

_mapView.delegate = self;

// customize the scale
_mapView.scale.scalePosition = CHGMapViewScalePositionTopRight;
_mapView.scale.topAdjustment = CGRectGetHeight(self.navigationController.navigationBar.bounds) + 30.f;

// finally show the scale
[_mapView showScaleWithAutomaticUpdates:YES];


## Customize the scale view

### Scale unit (Default: Miles)

```objc
_mapView.scale.scaleUnit = CHGMapViewScaleUnitMiles;

Position (Default: TopCenter and 30px from top of view)

_mapView.scale.scalePosition = CHGMapViewScalePositionTopRight;
_mapView.scale.topAdjustment = CGRectGetHeight(self.navigationController.navigationBar.bounds) + 30.f;

Size (Default: 0.2 -> 20%)

_mapView.scale.viewToScaleRation = 0.5f;

Color (Default: Black)

_mapView.scale.scaleColor = [UIColor blackColor];
_mapView.scale.scaleTextColor = [UIColor blackColor];

Text alignment (Default: Right)

_mapView.scale.scaleTextAlignment = NSTextAlignmentRight;

Author

Christian Greth, [email protected]

License

CHGMapViewScale is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "CHGMapViewScale",
    "version": "1.0.2",
    "summary": "Add a graphical scale to a GMSMapView.",
    "description": "Add a graphical scale directly to a GMSMapView.",
    "homepage": "https://github.com/grethi/CHGMapViewScale",
    "license": "MIT",
    "authors": {
        "Christian Greth": "[email protected]"
    },
    "source": {
        "git": "https://github.com/grethi/CHGMapViewScale.git",
        "tag": "1.0.2"
    },
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "frameworks": [
        "UIKit",
        "GoogleMaps"
    ],
    "dependencies": {
        "BlocksKit": [],
        "GoogleMaps": [
            "<2.0.0"
        ]
    }
}

Pin It on Pinterest

Share This