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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:55:14+00:00 2026-06-04T10:55:14+00:00

I was trying to implement a tableview like this one please read the comment

  • 0

I was trying to implement a tableview like this one

please read the comment to see the link <1>

My implementation is:
1. i create my cell from a nib!
please read the comment to see the link <2>

  1. For testing purpose i hardcode the heading part of the cell, and i create the rest in the code like this …

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:                (NSIndexPath *)indexPath
    {
        UITableViewCell *myCell = (UITableViewCell*) 
        [self.tableView dequeueReusableCellWithIdentifier:@"CheckedOutOrderTableCell"];
    
        [[NSBundle mainBundle] loadNibNamed:@"CheckedOutOrderTableCell" owner:self options:NULL];
        myCell = nibLoadedTableCell;
    
        UILabel *orderConditionLabel = [[UILabel alloc] initWithFrame:CGRectMake(250, (85+([[bigDictionary objectAtIndex:indexPath.row]count]*35)), 64, 21)];
        [orderConditionLabel setText:@"Delivered"];
        [orderConditionLabel setFont:[UIFont systemFontOfSize:14]];
        orderConditionLabel.textColor = [UIColor darkGrayColor];
        orderConditionLabel.backgroundColor = [UIColor clearColor];
    
        for(NSInteger i=0; i<[[bigDictionary objectAtIndex:indexPath.row]count]; i++)
        {
            UILabel *quantityLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 85+(i*35), 42, 21)];  
            UILabel *foodLabel = [[UILabel alloc] initWithFrame:CGRectMake(85, 85+(i*35), 175, 21)];
            UILabel *priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(220, 85+(i*35), 60, 21)];
    
            [quantityLabel setFont:[UIFont systemFontOfSize:15]];
            [foodLabel setFont:[UIFont systemFontOfSize:15]];
            [priceLabel setFont:[UIFont systemFontOfSize:15]];
    
            [quantityLabel setText:[NSString stringWithFormat:@"%@",[[[bigDictionary objectAtIndex:indexPath.row]objectAtIndex:i]valueForKey:@"quantity"]]];           
            [foodLabel setText:[NSString stringWithFormat:@"%@",[[[bigDictionary objectAtIndex:indexPath.row]objectAtIndex:i]valueForKey:@"item_name"]]];        
            [priceLabel setText:[NSString stringWithFormat:@"$ %@.00", [[[bigDictionary objectAtIndex:indexPath.row]objectAtIndex:i]valueForKey:@"price"]]];   
    
            [self.view addSubview:quantityLabel];
            [self.view addSubview:foodLabel];
            [self.view addSubview:priceLabel]; 
            quantityLabel = nil;
            foodLabel = nil;
            priceLabel = nil;
        }
        [self.view addSubview:orderConditionLabel];
        orderConditionLabel = nil;
        return myCell;
    }
    
  2. and of course i also rewrite heightForRowAtIndexPath: and i finally got this one…

https://i.stack.imgur.com/cF7Y4.png

  1. everything seems going right 😀 all the label are dynamic created and the position goes perfect… then i tried to save any other record…. and got crashed :'(

https://i.stack.imgur.com/RAXMF.png

  1. I check the data I fed into those cells using NSLOG and below is the structure of my “bigDictionary”

    2012-05-17 12:17:50.330 LazBuy[53187:11903] show structure (
            (
                    {
                "item_name" = "\U8292\U679c\U9752\U8336";
                price = 30;
                quantity = 1;
            },
                    {
                "item_name" = "\U6587\U5c71\U6e05\U8336";
                price = 20;
                quantity = 3;
            },
                    {
                "item_name" = "\U8292\U679c\U9752\U8336";
                price = 30;
                quantity = 3;
            }
        ),
            (
                    {
                "item_name" = "\U51cd\U9802\U70cf\U9f8d\U8336";
                price = 15;
                quantity = 3;
            }
        )
    )
    
  2. The data are fed properly, I do not know what is going wrong!

Why the label didnt update properly, do I need to release them? But I cant release as ARC do not let me do the release line.

  • 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-04T10:55:15+00:00Added an answer on June 4, 2026 at 10:55 am

    You are adding the labels to self.view? Theses should be on the tableviewcell.

    [self.view addSubview:quantityLabel];
    [self.view addSubview:foodLabel];
    [self.view addSubview:priceLabel];
    

    and

    [self.view addSubview:orderConditionLabel];
    

    Also your tableviewcell reuse should look more like this

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
    {
     static NSString *MyIdentifier = @"MyIdentifier";
    
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
        if (cell == nil) {
            [[NSBundle mainBundle] loadNibNamed:@"TVCell" owner:self options:nil];
            cell = tvCell;
            self.tvCell = nil;
        }
    
        // Set your labels text
    
        return cell;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement editable cell in tableview, just like what is available
I am trying to implement -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath So far this is what
I'm trying to implement a segue from one a table view controller to another
I am trying to delete a cell on tableView with sliding my finger (like
I am now trying to implement a app like picking image and video from
I'm trying to implement a TableView inside a UIView in Storyboard. This is what
I am using custom cell and adding tableview programmetically. I am trying to implement
import I am trying to implement a custom cell to use in my tableview
I'm trying to implement a custom UITableView cell as the prototype for a tableview.
I am trying to implement UITableview based application. In my tableView their is 10

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.