【发布时间】:2014-05-31 23:32:14
【问题描述】:
我正在使用以下for循环来管理/找出距离用户位置最近的五个注释,然后将它们设置为mapView的注释。
for (int i = 0; i <= 5; i++) {
//NSLog(@"Stores Count For Loop: %i", [storesLessThan100KAway count]);
if ([storesLessThan100KAway count] > 5) {
NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"distanceToTarget" ascending:YES];
NSArray *newArray = [storesLessThan100KAway sortedArrayUsingDescriptors:[NSArray arrayWithObject:descriptor]];
[mapView addAnnotation:[newArray objectAtIndex:i]];
if ([[mapView annotations] count] > 4) {
[descriptor release];
[dict release];
[currentlocation release];
[usrlocation release];
[annotation release];
[paul drain];
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
return;
}
}
但是,在地图放大或移动之前,不会显示添加到地图的注释。无论如何我可以阻止它吗?
【问题讨论】:
标签: iphone objective-c xcode ios4 android-mapview