Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8952141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:48:38+00:00 2026-06-15T13:48:38+00:00

I am using for loop for get distance from current location to destination location.

  • 0

I am using for loop for get distance from current location to destination location. I would like an array that contains all distances from current to destination location.

for (i = 0; i < [Arr_Lat count]; i++)  
{
    NSString *latst1 = [[NSString alloc]initWithFormat:[Arr_Lat objectAtIndex:i]];
    NSString *longst1 = [[NSString alloc]initWithFormat:[Arr_Long objectAtIndex:i]];

    NSLog(@"First lat : %@",latst1);
    NSLog(@"First  ong : %@",longst1);

    double Doblat1 = [latst1 doubleValue];
    double Doblong1 = [longst1 doubleValue];

    CLLocationCoordinate2D coord1 = CLLocationCoordinate2DMake(coord1.latitude = Doblat1, coord1.longitude = Doblat1);

    NSLog(@" Coordinat ==== : %f -- %f",coord1.latitude,coord1.longitude) ;

    CLLocation *currLoc = [[CLLocation alloc] initWithLatitude:appDel.curr_lat longitude:appDel.curr_long];

    CLLocation *destLoc1 = [[CLLocation alloc] initWithLatitude:Doblat1 longitude:Doblong1];

    NSLog(@" Currennt Location : %@", currLoc);
    NSLog(@" Destination Location : %@" , destLoc1);

    distance = [destLoc1  distanceFromLocation:currLoc];

    NSLog(@" Distance  :   ------- %0.3f", distance);

    DistStr = [[NSString alloc]initWithFormat:@" %f",distance];

    [currLoc release];

    [destLoc1 release];
    [Arr_title retain];

    [tbl_nearplace reloadData];
} 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:48:39+00:00Added an answer on June 15, 2026 at 1:48 pm
    NSMutableArray *Distance=[[NSMutableArray alloc]Init];
    
    for (i = 0; i < [Arr_Lat count]; i++)  
    {
        NSString *latst1 = [[NSString alloc]initWithFormat:[Arr_Lat objectAtIndex:i]];
        NSString *longst1 = [[NSString alloc]initWithFormat:[Arr_Long objectAtIndex:i]];
    
        NSLog(@"First lat : %@",latst1);
        NSLog(@"First  ong : %@",longst1);
    
        double Doblat1 = [latst1 doubleValue];
        double Doblong1 = [longst1 doubleValue];
    
        CLLocationCoordinate2D coord1 = CLLocationCoordinate2DMake(coord1.latitude = Doblat1, coord1.longitude = Doblat1);
    
        NSLog(@" Coordinat ==== : %f -- %f",coord1.latitude,coord1.longitude) ;
    
        CLLocation *currLoc = [[CLLocation alloc] initWithLatitude:appDel.curr_lat longitude:appDel.curr_long];
    
        CLLocation *destLoc1 = [[CLLocation alloc] initWithLatitude:Doblat1 longitude:Doblong1];
    
        NSLog(@" Currennt Location : %@", currLoc);
        NSLog(@" Destination Location : %@" , destLoc1);
    
        distance = [destLoc1  distanceFromLocation:currLoc];
    
        NSLog(@" Distance  :   ------- %0.3f", distance);
    
        NSString *DistStr = [[NSString alloc]initWithFormat:@" %f",distance];
    
        [Distance addObject:DistStr];
    
        [DistStr release];
        [currLoc release];
    
        [destLoc1 release];
        [Arr_title retain];
    
        [tbl_nearplace reloadData];
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a foreach loop to get images from the graph API in facebook.
I am using a PHP while loop in order to get data from a
I just designed a simple For Loop using window form application. I would like
I would like to do a loop and inside the loop get the previous
I am trying to sort my locations array from shortest to longest distance with
I want to create a matrix without using any loop, like in the following
I wrote a function that tries to get a y/n (yes/no) answer from a
I'm calculating the Euclidean distance between n-dimensional points using OpenCL. I get two lists
I'm using The Loop in my own theme template to get the last three
Here is the link: http://alchemist3d.com/maptest.html Also I'm using geocoder in a loop to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.