问题
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