如何验证经纬度 [英] How to validate latitude and longitude

查看:124
本文介绍了如何验证经纬度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个UITextField,用户可以在其中输入纬度和经度,然后使用这些坐标在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆