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

  • SEARCH
  • Home
  • 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 9175593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:56:29+00:00 2026-06-17T16:56:29+00:00

I m implementing the concept of sectioned tableview and struck at a particular point.

  • 0

I m implementing the concept of sectioned tableview and struck at a particular point.
I have a NSMutableArray with 2 objects like this:

<__NSArrayI 0xabf8c00>(
    {
        City = "SanFransisco ";
        Latitude = "28.602704";
        Longitude = "-81.430760";
        State = California;
    },
    {
        City = Orlando;
        Latitude = "28.49379";
        Longitude = "-81.474251";
        State = Florida;
    },

    )
    ,
    <__NSCFArray 0xab38ec0>(
    {
        geometry =     {
            location =         {
                lat = "37.789632";
                lng = "-122.417004";
            };
        };
        name = "St. Francis Memorial Hospital";
        vicinity = "900 Hyde Street, San Francisco";
    },
    {
        geometry =     {
            location =         {
                lat = "37.794363";
                lng = "-122.395784";
            };
        };
        name = "St Memorial Hospital";
        vicinity = "5 Embarcadero Center, San Francisco";
    },
    {
        geometry =     {
            location =         {
                lat = "37.788297";
                lng = "-122.409653";
            };
        };
        name = "Global Memorial Hospital";
        vicinity = "490 Post Street #520, San Francisco";
    },
    )

I m loading these 2 objects in two sections of tableView. But, I couldnot get how to compare and take in NSMutableDictionary for each key(city,latitude,longitude)of fist object and lat,lng,vicinity of second object. I have done like this but Im getting error :**SIGABRT error**

EDIT :

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault    reuseIdentifier:CellIdentifier]autorelease];
        cell.accessoryType= UITableViewCellAccessoryDetailDisclosureButton;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;



    }

    NSMutableArray *array = [listOfItems objectAtIndex:indexPath.section];
    int section=indexPath.section;


    if(section==0)
    {

        for (int i=0;i<[array count];i++)
        {

        cell.textLabel.text = [[array  objectAtIndex:i] objectForKey:@"City"] ;

        cell.textLabel.tag=3;
        cell.textLabel.font=[UIFont boldSystemFontOfSize:12];

        NSString *lat=[NSString stringWithFormat:@"%@",[[array  objectAtIndex:i] objectForKey:@"Latitude"]];
        UILabel *latitude = [[UILabel alloc]initWithFrame:CGRectMake(10, 50, 320, 10)];
        latitude .font=[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:12];
        [latitude  setTextAlignment:UITextAlignmentLeft];
        latitude.text=[NSString stringWithFormat:@"%@",lat];
        latitude.tag=1;
        [cell addSubview:latitude ];
        latitude.hidden=YES;
        [latitude release];


        NSString *lng=[NSString stringWithFormat:@"%@",[[array  objectAtIndex:i] objectForKey:@"Longitude"]];
        UILabel *longitude = [[UILabel alloc]initWithFrame:CGRectMake(10, 80, 320, 10)];
        longitude .font=[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:12];
        [longitude  setTextAlignment:UITextAlignmentLeft];
        longitude.text=[NSString stringWithFormat:@"%@",lng];
        longitude.tag=2;
        [cell addSubview:longitude ];
        longitude.hidden=YES;
        [longitude release];


         return cell;

    }
    }

    if(section==1)
    {




        for (int i=0;i<[array count];i++)
        {


             cell.textLabel.text =[[array  objectAtIndex:i] objectForKey:@"name"] ;

            cell.textLabel.lineBreakMode=UILineBreakModeWordWrap;
            cell.textLabel.numberOfLines=0;
            cell.textLabel.font=[UIFont boldSystemFontOfSize:12];
            cell.textLabel.tag=3;



            NSMutableDictionary * location = [[[array objectAtIndex:indexPath.row]objectForKey:@"geometry"]objectForKey:@"location"];
            NSString * lat = [location objectForKey:@"lat"];
            NSString * lng = [location objectForKey:@"lng"];

            UILabel *latitude = [[UILabel alloc]initWithFrame:CGRectMake(10, 80, 320, 10)];
            latitude .font=[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:12];
            [latitude  setTextAlignment:UITextAlignmentLeft];
            latitude.text=[NSString stringWithFormat:@"%@",lat];

            latitude.tag=1;
            [cell addSubview:latitude ];
            latitude.hidden=YES;
            [latitude release];



            UILabel *longitude = [[UILabel alloc]initWithFrame:CGRectMake(10, 85, 320, 10)];
            longitude .font=[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:12];
            [longitude  setTextAlignment:UITextAlignmentLeft];
            [longitude  setText:[NSString stringWithFormat:@"%@",lng]];
            longitude.tag=2;
            [cell addSubview:longitude ];
            longitude.hidden=YES;
            [longitude release];


            NSString *vicinity1 = [[array objectAtIndex:indexPath.row]objectForKey:@"vicinity"];
            UILabel *vicinity = [[UILabel alloc]initWithFrame:CGRectMake(10, 45, 320, 10)];
            vicinity .font=[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:12];
            [vicinity  setTextAlignment:UITextAlignmentLeft];
            vicinity.text=[NSString stringWithFormat:@"%@",vicinity1];

            vicinity.tag=4;
            [cell addSubview:vicinity ];
            vicinity.hidden=YES;
            [vicinity release];



             return cell;



        }


    }



}

Where I m going wrong this time?

  • 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-17T16:56:30+00:00Added an answer on June 17, 2026 at 4:56 pm

    By your error I understand that your variable dictionary is not actually a dictionary but an array.

    try using this :

    NSMutableArray *array = [listOfItems objectAtIndex:indexPath.row];
    cell.textLabel.text = [[array  objectAtIndex:0] objectForKey:@"City"];
    

    If this returns something(or some name) maybe you can change your logic accordingly and get the desired result.

    Let me know if it works 🙂

    EDIT :

    int section=indexPath.section;
    
    
        if(section==0)
        {
            NSMutableArray *array = [listOfItems objectAtIndex:indexPath.row];
    
            for (int i=0;i<[array count];i++)
            {
    
            cell.textLabel.text = [[array  objectAtIndex:i] objectForKey:@"City"] ;
    
            cell.textLabel.tag=3;
            ....
    

    indexPath.section will always return 0

    Try this 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im current implementing the permission like this: Permission UserPermision User ------------------- ---------------------- ----------------- PNAME
I'm quite new to java OOP concept. I have some problems in implementing some
implementing publishActivity in PHP using the REST API using this code: $activity = array(
Implementing a simple Login screen using JSF and Spring and Hibernate. I have written
Does anyone have experience with implementing OpenID on a non technical website? If you
I am currently implementing a method that accepts two bitmap objects. We can assume
I'm implementing a simple proof of concept Telnet server in C# and telnet to
Windows-7 introduced a concept of virtual folder, called 'Libraries'. I am working on implementing
This current project is more of a proof of concept for a larger project.
Is the approach for implementing substitution caching in MVC 3 contained in this page

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.