Retrieving Current Location and Zip using Geolocation Button

南笙酒味 提交于 2019-12-02 19:34:44

问题


I want to place a Geolocation button near my UISearchBar, which on clicking, it should return the zip (eg. 20043). I will be using the value from the ZIP to get the list of buildings near me.

I would appreciate it if someone could help me with the location Button, and what are the methods to implement to return just the ZIP (integer) ? And would a custom UIButton work for the location button ?

Thank you!


回答1:


In iOS 4 there is no forward geocoded (turning an address into lat/long), there are some enhancements to this in iOS 5 (this is under NDA, so you'll need to visit the Apple developers site).

If you're looking for something now, here is a forward geocoder you can use: http://blog.sallarp.com/ipad-iphone-forward-geocoding-api-google/

As for the button, there is this project that has many of the commonly used map kit buttons: https://github.com/myell0w/MTLocation



来源:https://stackoverflow.com/questions/6496566/retrieving-current-location-and-zip-using-geolocation-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!