Below is the function which i m using to fill array with the help of Database
RecipieAppDelegate *appDelegate = (RecipieAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate getallrecords];
self.namesArray=appDelegate.rs;
///filling array with database
for (int i=0; i<namesArray.count; i++) {
Food *product = (Food *)[self.namesArray objectAtIndex:i];
NSLog(@"%d",i);
appDelegate.mylatitude=product.Latitude;
appDelegate.mylongitude=product.Longitude;
/// this function is use to call the class which is use to drop pin on map
BridgeAnnotation *BridgePin = [[BridgeAnnotation alloc] init];
[self.mapAnnotations insertObject:BridgePin atIndex:kBridgeAnnotationIndex];
[BridgePin release];
}
/////CLASS BRIDGE ANNOTATION below is the function getting cordinate from above function n droping pin
- (CLLocationCoordinate2D)coordinate;
{
RecipieAppDelegate *appDelegate = (RecipieAppDelegate *)[[UIApplication sharedApplication] delegate];
Food *product;
CLLocationCoordinate2D theCoordinate;
// theCoordinate.latitude = 37.810000;
// theCoordinate.longitude = -122.477989;
theCoordinate.latitude = [appDelegate.mylatitude doubleValue];
NSLog(@"%f", theCoordinate.latitude);
theCoordinate.longitude = [appDelegate.mylongitude doubleValue];
NSLog(@"%f", theCoordinate.longitude);
return theCoordinate;
}
хорошо, я отлично запускаю цикл в массиве 5 раз, но передаю последнее значение второй функции
, ожидая вашего ответа