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 8866913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:53:51+00:00 2026-06-14T16:53:51+00:00

i am passing data from one view to the other using xml parser.when i

  • 0

i am passing data from one view to the other using xml parser.when i click on any row(after the xml is loaded on the view) it should display the entire details accordingly.
– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    UILabel *titleLabel = nil;
    UILabel *priceLabel = nil;

    UILabel *titleValueLabel = nil;
    UILabel *priceValueLabel = nil;

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];

        titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 20)];
        titleLabel.text = @"Model:";

        priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, 50, 20)];
        priceLabel.text = @"Price:";


        priceValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(120, 20, 50, 20)];
        titleValueLabel = [[UILabel alloc]initWithFrame:CGRectMake(120, 1, 320, 20)];

        [cell.contentView addSubview:titleLabel];
        [cell.contentView addSubview:priceLabel];


        [cell.contentView addSubview:titleValueLabel];
        [cell.contentView addSubview:priceValueLabel];

    }


    NSDictionary *tempProduct = [self.listData objectAtIndex:indexPath.row];
    NSDictionary *productTitle = [tempProduct valueForKey:TITLE];
    NSString *titleValue = [productTitle valueForKey:TEXT];
    titleValue = [titleValue stringByTrimmingCharactersInSet:
              [NSCharacterSet whitespaceAndNewlineCharacterSet]];
    titleValueLabel.text = titleValue;
    [cell.contentView addSubview:titleValueLabel];


    NSDictionary *productPrice = [tempProduct valueForKey:PRICE];
    NSString *priceValue = [productPrice valueForKey:TEXT];
    priceValue = [priceValue stringByTrimmingCharactersInSet:
              [NSCharacterSet whitespaceAndNewlineCharacterSet]];
    priceValueLabel.text = priceValue;
    [cell.contentView addSubview:priceValueLabel];


    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

    return cell;
}

and my sample xml data is

<?xml version="1.0" encoding="UTF-8"?>
<scan>
    <products>
        <title>samsung galaxy</title>
        <desc>smart phone</desc>
        <price>250$</price>
    </products>
    <products>
        <title>samsung galaxy1</title>
        <desc>smart phone1</desc>
        <price>251$</price>
     </products>
    <products>
        <title>samsung galaxy2</title>
        <desc>smart phone2</desc>
        <price>252$</price>
    </products>
    <products>
        <title>samsung galaxy3</title>
        <desc>smart phone3</desc>
        <price>350$</price>
    </products>
    </scan>

when i click on the first row,it should display the same data.but it is displaying in the order of the selection.
how to fix this?

  • 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-14T16:53:52+00:00Added an answer on June 14, 2026 at 4:53 pm

    you can just passing index like that

    - (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];
            NSDictionary *tempProduct = [self.listData objectAtIndex:indexPath.row];
            titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 20)];
           [Name setText:[tempProduct valueForKey:@"TITLE"]];
    
            priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, 50, 20)];
            [Name setText:[tempProduct valueForKey:@"Price"]];
    
    
            priceValueLabel = [[UILabel alloc] initWithFrame:CGRectMake(120, 20, 50, 20)];
            titleValueLabel = [[UILabel alloc]initWithFrame:CGRectMake(120, 1, 320, 20)];
    
            [cell.contentView addSubview:titleLabel];
            [cell.contentView addSubview:priceLabel];
    
    
            //[cell.contentView addSubview:titleValueLabel];
           // [cell.contentView addSubview:priceValueLabel];
    
        }
    
    
    
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    
        return cell;
    }
    

    EDIT

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
                NSDictionary *tempProduct = [self.listData objectAtIndex:indexPath.row];
    
              objAppDelegate.strCatagoryTitle=[tempProduct valueForKey:@"TITLE"];
              objAppDelegate.strCatagoryPrice=[tempProduct valueForKey:@"Price"];
    
    //hear  objAppDelegate.strCatagoryTitle or objAppDelegate.strCatagoryPrice globle string.
    //we can use it at our cntrSecondViewController class using this Delegate object 
    //objAppDelegate = (cntrAppDelegate1 *) [[UIApplication sharedApplication]delegate];
    
    
     cntrSecondViewController *cntrinnerService = [[cntrSecondViewController alloc] initWithNibName:@"cntrSecondViewController" bundle:nil];
            [self.navigationController pushViewController:cntrinnerService animated:YES];
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am passing some information from one view to the other using delegates, However
Currently I'm using AudioTrack passing to it audio data from native layer to play.
i have data structure i am passing this from server to client using data
Been researching how to send data from one child view to another child view.
AFAIK, there are two ways of passing data to the view from controller :
In my MVC application I have a problem with passing data from view to
I am trying to pass data from a UITextView in one view controller to
I'm passing from my view page one to five images to controller. <input type=file
I am having trouble passing data from one activity to another. I can easily
There are many examples of passing data between two view controllers, where one view

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.