如何验证纬度和经度 [英] How to validate latitude and longitude
本文介绍了如何验证纬度和经度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个 UITextFields,用户可以输入纬度和经度,然后使用这些坐标在 MKMapView 上创建图钉.
I have two UITextFields which users can enter in a latitude and longitude, these co-ordinates are then used to create a pin on an MKMapView.
我想找到一种方法来验证他们输入的值是实际的 GPS 坐标还是只是一堆垃圾.有没有办法做到这一点?
I want find a way to validate whether the values they enter are actual GPS co-ordinates or just a load of rubbish. Is there any way of doing this?
推荐答案
纬度必须是介于-90 和 90 以及 经度 在 -180 和 180 之间.
The latitude must be a number between -90 and 90 and the longitude between -180 and 180.
这篇关于如何验证纬度和经度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文