NearbyUser
这个库用于根据您的半径,从您当前的位置找到附近用户。
示例
要运行示例项目,首先克隆仓库,然后从Example目录中运行 pod install
。
要求
- Xcode 6或更高版本
- iOS 8或更高版本
安装
NearbyUser可以通过CocoaPods获得。安装它,只需将以下行添加到您的Podfile中
pod 'NearbyUser'
用法
- Objective C
#import "NearbyUser-Swift.h"
- Swift
import NearbyUser
如何使用
1.创建mapManagers类对象[该类位于pod中]
示例
var mapObject = mapManagers()
2.mapManagers类以下方法返回类型为GMSMapView
public func initLocationManagerWithRadiusAndMap(getRadius: String, googleMapView: GMSMapView) -> GMSMapView
{
返回 GMSMapView
}
上述方法的用法
gMap = mapObject.initLocationManagerWithRadiusAndMap(getRadius: "yourradiusvalue", googleMapView: gMap)
(在viewDidLoad或其他根据您偏好的位置)
3.mapManagers类有如下变量
/// 此变量用于存储所有用户从json/api的信息
public var userInformation: [[String: String]] = []
/// 此变量用于设置自定义标记图像
public var pinImage = UIImage()
/// 此变量用于标记图像中的占位符图像
public var userPlaceholderImage = UIImage() /// 此变量用于存储用户的当前位置 public var currentLocationCoordinates = CLLocationCoordinate2D()
上述变量的用法
mapObject.userInformation = "yourData from api/json"
mapObject.pinImage = UIImage(named: "yourImage")!
mapObject.userPlaceholderImage = UIImage(named: "yourImage")!
4.以下方法用于获取半径内的用户和标记
/// 此方法用于获取半径内的所有用户
/// - 返回值:[[String: String]]的值
public func getAllVisibleUserFromRadius() -> [[String: String]]
{
返回 [[String: String]]
}
/// 此方法用于获取半径内的所有标记
/// - 返回值:GMSMarker
public func getAllVisibleMarkerFromRadius() -> [GMSMarker]
{
返回 [GMSMarker]
}
注意
gMap - 你的GMSMapView的出口[在你的项目中使用]
mapObject - mapManagers类的实例
作者
RajeshwariU, [email protected]
许可协议
NearbyUser可在MIT许可下使用。请参阅LICENSE文件了解更多信息。