CHGMapViewScale 1.0.2

CHGMapViewScale 1.0.2

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最近发布2017年5月

Christian Greth维护。



 
依赖
BlocksKit>= 0
GoogleMaps< 2.0.0
 

  • 作者
  • Christian Greth

限制

此 Pod 仅与 GoogleMaps < 2.0.0 兼容。已在 iOS 7 到 iOS 10.3 上进行了测试。

示例

Screenshot of example CHGMapViewController

要运行示例项目,请克隆仓库,并首先从 Example 目录运行 pod install

需求

此 Pod 依赖于 GoogleMaps 框架以及 pod BlocksKit。

安装

CHGMapViewScale 可通过 CocoaPods 使用。安装时,只需将以下行添加到 Podfile 中

pod "CHGMapViewScale"

使用方法

使用刻度有两种不同的方式

  • 直接使用(例如: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];
  • 或包裹在 CHGMapView 中(例如: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];

自定义刻度视图

刻度单位(默认:英里)

_mapView.scale.scaleUnit = CHGMapViewScaleUnitMiles;

位置(默认:视图顶部居中并且距离顶部30px)

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

大小(默认:0.2 -> 20%)

_mapView.scale.viewToScaleRation = 0.5f;

颜色(默认:黑色)

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

文本对齐(默认:右对齐)

_mapView.scale.scaleTextAlignment = NSTextAlignmentRight;

作者

Christian Greth,[email protected]

许可证

CHGMapViewScale 可在 MIT 许可证下使用。有关更多信息,请参阅 LICENSE 文件。