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

我正在开发一种具有RADAR功能的应用程序,就像LOVOO应用程序一样.我没有在CoreLocation和其他基于位置的框架上工作的经验.

如果你能建议我该如何实现,这将是非常感谢的.
我应该使用什么框架,以及如何最初进行.

虽然在这方面已经存在同样的问题,但我的问题与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是否正确,如果它们是正确的,那么如何更改这些值与滑块值的更改.

解决方法

我认为这里的关键字是Geofencing.

如果您的设备进入或离开某个区域,则地理围栏是自动触发操作.对于您的情况,您的操作是显示进入雷达区域的用户的配置文件.

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

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

我希望它有帮助!

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...