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