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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:05:43+00:00 2026-05-29T11:05:43+00:00

now i am getting text in labels of table view when i update item

  • 0

now i am getting text in labels of table view when i update item array that is globally declared at 0 index and return back then it wont update the row in table view row at index 0 but when i update other rows then it updates. And also when i scroll table view towards upward then it shows value at index 0 on all index. here is my code

- (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];    
nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(45, 8, 100, 25)];
nameLabel.backgroundColor = [UIColor clearColor];
nameLabel.font = [UIFont fontWithName:@"Arial" size:16];
[cell addSubview:nameLabel];

deleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
deleteButton.frame= CGRectMake(3, 3, 30, 30);
[deleteButton setImage: [UIImage imageNamed:@"cross_btn.png"] forState:UIControlStateNormal];
[cell addSubview:deleteButton];

priceMark = [[UILabel alloc]initWithFrame:CGRectMake(200, 8, 60, 25)]; //150, 8, 65, 25
priceMark.backgroundColor = [UIColor clearColor];
priceMark.font = [UIFont fontWithName:@"Arial" size:14];
[cell addSubview:priceMark]; 

qtyLabel = [[UILabel alloc]initWithFrame:CGRectMake(160, 8, 65, 25)]; //225, 8, 60, 25
qtyLabel.backgroundColor = [UIColor clearColor];
qtyLabel.font = [UIFont fontWithName:@"Arial" size:14];
[cell addSubview:qtyLabel];
 }
 nameLabel.text = [[itemsArray objectAtIndex:indexPath.row] objectForKey:@"itemname"];
priceMark.text = [NSString stringWithFormat:@"Rs: %@",[[itemsArray 
objectAtIndex:indexPath.row] objectForKey:@"amount"]];
qtyLabel.text = [[itemsArray objectAtIndex:indexPath.row] objectForKey:@"qty"];

return cell;
 }
  • 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-05-29T11:05:44+00:00Added an answer on May 29, 2026 at 11:05 am

    change your code to:

      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
      if (cell == nil) 
      {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 
    reuseIdentifier:CellIdentifier] autorelease];    
    nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(45, 8, 100, 25)];
    nameLabel.backgroundColor = [UIColor clearColor];
    nameLabel.font = [UIFont fontWithName:@"Arial" size:16];
    //added
    nameLabel.tag = 101;
    [cell addSubview:nameLabel];
    
    deleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
    deleteButton.frame= CGRectMake(3, 3, 30, 30);
    [deleteButton setImage: [UIImage imageNamed:@"cross_btn.png"] forState:UIControlStateNormal];
    //added
    deleteButton.tag = 102;
    [cell addSubview:deleteButton];
    
    priceMark = [[UILabel alloc]initWithFrame:CGRectMake(200, 8, 60, 25)]; //150, 8, 65, 25
    priceMark.backgroundColor = [UIColor clearColor];
    priceMark.font = [UIFont fontWithName:@"Arial" size:14];
    //added
    priceMark.tag = 103;
    
    [cell addSubview:priceMark]; 
    
    qtyLabel = [[UILabel alloc]initWithFrame:CGRectMake(160, 8, 65, 25)]; //225, 8, 60, 25
    qtyLabel.backgroundColor = [UIColor clearColor];
    qtyLabel.font = [UIFont fontWithName:@"Arial" size:14];
    //added
    qtyLabel.tag = 104;
    
    [cell addSubview:qtyLabel];
     }
    
    //Added
    nameLabel = (UILabel*)[cell viewWithTag:101];
    deleteButton = (UIButton*)[cell viewWithTag:102];
    priceMark = (UILabel*)[cell viewWithTag:103];
    qtyLabel = (UILabel*)[cell viewWithTag:104];
    //
    
     nameLabel.text = [[itemsArray objectAtIndex:indexPath.row] objectForKey:@"itemname"];
    priceMark.text = [NSString stringWithFormat:@"Rs: %@",[[itemsArray 
    objectAtIndex:indexPath.row] objectForKey:@"amount"]];
    qtyLabel.text = [[itemsArray objectAtIndex:indexPath.row] objectForKey:@"qty"];
    
    return cell;
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a global declared array and loading that array in table view but
Up until now I used DateTime.Now for getting timestamps, but I noticed that if
In my application i have a table view controller that builds a table with
I have table view in that click any i am displaying data in overlay
I had a class loader working although I am now getting an error after
I just upgraded jQuery to version 1.4.2 and I am now getting an error
After installing .NET 4.0, I am now getting an exception on this statement: if
We just switched to Glassfish V2. We are now getting errors when setting a
Getting going now with NInject... :) For a WinForms application, and in particular the
I just updated PHP 5.2.0 to 5.2.11 and now I am getting loads of

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.