【发布时间】:2013-01-09 13:42:48
【问题描述】:
我是 iOS MapView 的新手,我刚刚创建了 mapview 和 uisearchbar outlets,如果我在搜索栏中输入一个词,PIN 会显示我的确切位置已经这样做了,
- (void) searchBarSearchButtonClicked:(UISearchBar *)theSearchBar
{
NSMutableString *urlString = [NSMutableString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@?output=json",inAddress];
[urlString setString:[urlString stringByReplacingOccurrencesOfString:@" " withString:@"+"]];
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
}
最后是缩放我的地图的功能,现在这应该是一件小事。
- (void) zoomMapAndCenterAtLatitude:(double) latitude andLongitude:(double) longitude
{
MKCoordinateRegion region;
region.center.latitude = latitude;
region.center.longitude = longitude;
MKCoordinateSpan span;
span.latitudeDelta = .005;
span.longitudeDelta = .005;
region.span = span;
[mapView setRegion:region animated:YES];
}
但如果有多个地点与搜索栏关键字匹配,则必须显示多个 PIN.. 示例:如果我输入 HOSPITALS in Washington,则必须显示华盛顿附近的医院 这里可以吗..?请帮帮我。
【问题讨论】:
标签: objective-c xcode mkmapview