雷达喜欢 LOVOO 应用程序与滑块

Posted

技术标签:

【中文标题】雷达喜欢 LOVOO 应用程序与滑块【英文标题】:Radar like LOVOO app with slider 【发布时间】:2015-01-01 07:12:34 【问题描述】:

我正在开发一个具有雷达功能的应用程序,就像 LOVOO 应用程序一样。我没有使用 CoreLocation 和其他基于位置的框架的经验。

如果您能建议我如何实现这一点,我们将不胜感激。 我应该使用什么框架以及如何开始。

虽然这里的 SO 上已经存在相同的问题,但我的问题与 Radar View like LOVOO 相同,但它对我没有用,这就是我再次问它的原因。

到目前为止,我自己尝试的是,我有要绘制的点的纬度和经度值,并且我已经计算了中心点(我的位置)和其他点之间的角度和距离

- (float)angletoCoordinate:(CLLocationCoordinate2D)second 

//myCurrentLocation is origin

//second is point

float lat1 = DegreesToRadians(myCurrentLocation.coordinate.latitude);
float lon1 = DegreesToRadians(myCurrentLocation.coordinate.longitude);

float lat2 = DegreesToRadians(second.latitude);
float lon2 = DegreesToRadians(second.longitude);

float dLon = lon2 - lon1;

float y = sin(dLon) * cos(lat2);
float x = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(dLon);
float radiansBearing = atan2(y, x);
if(radiansBearing < 0.0)

    radiansBearing += 2*M_PI;


return radiansBearing;



-(float)calculateXPointWithLoc:(ARGeoLocation *)loc andDelta:(float)delta
float angle = radiansToDegrees(delta);
float dpx = (([myCurrentLocation distanceFromLocation:loc.geoLocation])/1000);

if(0<=angle<=90)
    return viewRadar.center.x + sin(angle)*dpx ;
else if(90<angle<=180)
    return viewRadar.center.x + cos(angle-90)*dpx  ;
else if(180<angle<=270)
    return viewRadar.center.x - cos(270-angle)*dpx ;
else if(270<angle<360)
    return viewRadar.center.x - sin(360-angle)*dpx ;

return 0;


-(float)calculateYPointWithLoc:(ARGeoLocation *)loc andDelta:(float)delta
float angle = radiansToDegrees(delta);

float dpx = (([myCurrentLocation distanceFromLocation:loc.geoLocation])/1000);



if(0<=angle<=90)
    return viewRadar.center.y - cos(angle)*dpx ;
else if(90<angle<=180)
    return viewRadar.center.y + sin(angle-90)*dpx ;
else if(180<angle<=270)
    return viewRadar.center.y + sin(270-angle)*dpx ;
else if(270<angle<360)
    return viewRadar.center.y - cos(360-angle)*dpx ;

return 0;

然后

    int i = 0;
    for(ARGeoLocation *loc in coordinates)

    deltaAz = [self angletoCoordinate:loc.geoLocation.coordinate];
    x = [self calculateXPointWithLoc:loc andDelta:deltaAz];
    y = [self calculateYPointWithLoc:loc andDelta:deltaAz];

    [[plots objectAtIndex:i] setFrame:CGRectMake(x, y, DIAMETER_PLOT, DIAMETER_PLOT)];
    i++;
    

我不确定 x 和 y 是否正确,如果它们正确,那么我如何通过更改滑块值来更改这些值。

【问题讨论】:

我已经创建了一个类似的 LOVOO,例如带有滑块的 ios 雷达视图。它可以在 github 上找到。 github.com/abm-adnan/Radar 那真的很棒.. 我一定会看看你是如何做到的,但是是的,我也创建了它,但由于与我的客户签署了 NDA,所以没有公开它。谢谢 如果您需要任何帮助,请告诉我如何提供帮助。谢谢 【参考方案1】:

我认为这里的关键字是地理围栏

地理围栏是在您的设备进入或离开某个区域时自动触发操作。对于您的情况,您的操作是显示进入您的雷达区域的用户的个人资料。

基本上,您需要计算一个圆形区域(给定一个半径)并显示您所在区域内的所有其他点。

我曾经发现这个教程可以教你如何自己做: http://www.raywenderlich.com/95014/geofencing-ios-swift

希望对你有帮助!

【讨论】:

以上是关于雷达喜欢 LOVOO 应用程序与滑块的主要内容,如果未能解决你的问题,请参考以下文章

闪亮的应用程序,画笔功能与滑块相结合

jquery滑块,上面的值与滑块一起移动

Vuetify 滑块附加插槽文本字段未与滑块对齐

我想与滑块一起滑动/移动猫头鹰点

如何使范围滑块的左侧与滑块右侧的颜色不同?

jQuery滑块:颜色更改菜单不会与滑块的其余部分同步