MSFlightMapView 0.2.1

MSFlightMapView 0.2.1

Muhammad Abdul Subhan 维护。



  • Muhammad Abdul Subhan

MSFlightMapView

CocoaPods CocoaPods Twitter

演示

要求

  • iOS 10.0+
  • Xcode 9.0+

安装

只需将 MSFlightMapView 文件夹添加到您的项目中。

或使用 CocoaPods

pod 'MSFlightMapView'

使用

航班创建

要使用MSFlightMapView,我们需要创建MSFlight对象。创建方法如下:

1. MSFlight

MSFlight(withFirstLocation: London, withSecondLocation: Paris)

MSFlight是单程航班,具有目的和到达位置。我们可以设置以下航班属性:

firstLocation - 航班的出发地点

secondLocation - 航班的到达地点

iconImage - 标记图片

iconColor - 标记颜色

pathColor - 出发地点和到达地点之间的路径颜色

markerColor - 出发和到达地点标记的颜色

MSFlight可以通过使用.connecting(toLocation: CLLocationCoordinate2D)进一步扩展为联程航班,连接到一个MSFlight对象或一个MSFlight数组。

2. MSMultiLegFlight

MSMultiLegFlight(withLocations: [London, Berlin, Ankara, Moscow])

MSMultiLegFlight是多段航班连接多个地点之间的航班。它生成MSFlight对象,因此可以进一步进行定制,如上所述。

地图创建

MSFlightMapViewGMSMapView的子类。我们只需使用以下方法即可在地图上设置和显示航班:

对于MSFlight

let flight = MSFlight(withFirstLocation: London, withSecondLocation: Berlin).connecting(toLocation: Moscow)
mapView.flights = [flight]

对于MSMultiLegFlight

let flightPlan = MSMultiLegFlight(withLocations: [London, Berlin, Ankara, Moscow])
mapView.flights = flightPlan.flights

许可

MSFlightMapView发布在MIT许可证下。有关详细信息,请参阅LICENSE