問候, 我已經進入iOS只有1.5個月了,我希望我不要問一個已經在這裏得到解答的問題。那就是:iPhone - 用UITableview didSelectRowAtIndexPath方法顯示覆蓋圖
我的tableview是列出了一些持續時間每個屬於包含座標與時間戳覆蓋:
for (NSUInteger i = 0; i < [dataset count]; i++)
{
crumbPath = [[CrumbPath alloc] initWithCenterCoordinate:mapView.userLocation.coordinate]; //crumbPath is my overlay
NSDictionary *route = [dataset objectAtIndex:i];
NSArray *points = [route objectForKey:@"Points"];
for (NSUInteger j = 0; j < [points count]; j++)
{
NSDictionary *point = [points objectAtIndex:j];
float latitude = (float)([[point objectForKey:@"Latitude"] doubleValue]/1000000);
float longitude = (float)([[point objectForKey:@"Longitude"] doubleValue]/1000000);
CLLocationCoordinate2D tempCoord = CLLocationCoordinate2DMake(latitude, longitude);
[crumbPath addCoordinate:tempCoord];
}
[mapView addOverlay:crumbPath];
[crumbPath release];
}
據我所知,我可以列出我的tableview持續時間,我想現在要做的就是用tableView:didSelectRowAtIndexPath方法來顯示在tableview上點擊持續時間的疊加層。現在,我的疊加層都顯示在mapview上,我只想顯示選中的一個。
在此先感謝!
阿里
感謝您的回覆。我很快在didSelectRowAtIndex方法內使用數組發現了我的解決方案。 – 2011-04-05 10:13:46