ios - 如何格式化这样的坐标?

标签 ios format coordinates degrees

我需要这样格式化我的坐标:

N 61° 14.5919'
E 23° 28.1751'

现在我的坐标看起来像这样:
61.145919
23.281751

我的代码:
- (void)locationManager:(CLLocationManager *)manager
    didUpdateToLocation:(CLLocation *)newLocation
           fromLocation:(CLLocation *)oldLocation
{
    latitudeLabel.text = [NSString stringWithFormat:@"%f", newLocation.coordinate.latitude];
    longitudeLabel.text = [NSString stringWithFormat:@"%f", newLocation.coordinate.longitude];   
}

最佳答案

这个现有问题似乎对如何最好地解决提出了建议,另外还有一个可以为您解决的图书馆:
Convert decimal coordinate into degrees, minutes, seconds, direction

关于ios - 如何格式化这样的坐标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11878760/

相关文章:

Python 类 % 运算符重载

r - 坐标模糊匹配

php - 使用随机位置方法显示所有位置

mysql - 如何在相等的桶中按距离排序?

iphone - 提高核心动画的性能

java - 如何在 Java 中创建特定格式的 JSON 文件

ios - 如果对象的键不同,如何编写模型结构

Android edittext 仅输入货币格式

javascript - 为什么在 Android 或 iOS 设备上长按时 Javascript 会暂停?

ios - 当用户在 ios 13.0 中单击登录按钮时,Facebook 登录总是被取消,但在 ios 12.0 或更小的 swift 中完全工作正常