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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:26:57+00:00 2026-05-27T06:26:57+00:00

I am using 5 label,1 button,1 image view in custom cells of table view.but

  • 0

I am using 5 label,1 button,1 image view in custom cells of table view.but when i run my program scrolling of table is slow and also some label are overrided.how can improve performance of scrolling of table my code is as follow
Thanks.

 #define NAMELABEL_TAG 1
 #define VALUELABEL_TAG 2
 #define MYPRICELABEL_TAG 3
 #define SAVEPRICELABEL_TAG 4
 #define PRODUCTIMAGELABEL_TAG 5
 #define VLABEL_TAG 6
 #define YLABEL_TAG 7
 #define SLABEL_TAG 8

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


UILabel *nameLabel,*valueLabel,*myPriceLabel,*savePriceLabel,*vLabel,*yLabel,*sLabel;
UIImageView *productImage;
static NSString *CellIdentifier = @"Cell";

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



///my code....

 //CONFIGURE THE SLabel LABEL
 sLabel=[[[UILabel alloc]initWithFrame:CGRectMake(60, 32, 80, 32)]autorelease];
 sLabel.tag=SLABEL_TAG;
 //yLabel.textColor=[UIColor redColor];
 sLabel.font=[UIFont systemFontOfSize:12.0];

 //ADD THE LABEL TO CELLS CONTENT VIEW
 [cell.contentView addSubview:sLabel];


 //CONFIGURE THE YNAME LABEL
 yLabel=[[[UILabel alloc]initWithFrame:CGRectMake(185, 18, 80, 18)]autorelease];
 yLabel.tag=NAMELABEL_TAG;
 //yLabel.textColor=[UIColor redColor];
 yLabel.font=[UIFont systemFontOfSize:12.0];
 //ADD THE LABEL TO CELLS CONTANT VIEW
 [cell.contentView addSubview:yLabel];

 //CONFIGURE THE NAME LABEL
 nameLabel=[[[UILabel alloc]initWithFrame:CGRectMake(60, 0, 140, 20)]autorelease];
 nameLabel.tag=NAMELABEL_TAG;
 nameLabel.textColor=[UIColor redColor];
 //ADD THE LABEL TO CELLS CONTANT VIEW
 [cell.contentView addSubview:nameLabel];
 //configure the value label
 valueLabel=[[[UILabel alloc]initWithFrame:CGRectMake(112, 18, 60, 18)]autorelease];
 valueLabel.tag=VALUELABEL_TAG;
 valueLabel.font=[UIFont systemFontOfSize:12.0];
    //valueLabel.font=[UIFont fontWithName:@"verdana" size:12.0];
    //valueLabel.text=[UIFont 
 valueLabel.textColor=[UIColor redColor];
 [cell.contentView addSubview:valueLabel];

 //CONFIGURE THE myprice LABEL
 myPriceLabel=[[[UILabel alloc]initWithFrame:CGRectMake(262, 18, 40, 18)]autorelease];
 myPriceLabel.tag=MYPRICELABEL_TAG;
 myPriceLabel.font=[UIFont systemFontOfSize:12.0];
 myPriceLabel.textColor=[UIColor redColor];
 //ADD THE LABEL TO CELLS CONTACT VIEW
 [cell.contentView addSubview:myPriceLabel];

 //CONFIGURE THE saveprice LABEL
 savePriceLabel=[[[UILabel alloc]initWithFrame:CGRectMake(135, 32, 50, 32)]autorelease];
 savePriceLabel.tag=SAVEPRICELABEL_TAG;
 savePriceLabel.font=[UIFont systemFontOfSize:12.0];
 savePriceLabel.textColor=[UIColor redColor];
 //ADD THE LABEL TO CELLS CONTACT VIEW
 [cell.contentView addSubview:savePriceLabel];

 // Configure the product Image
 productImage = [[[UIImageView alloc]
 initWithFrame:CGRectMake(0.0, 0.0, 50.0, 60.0)]
 autorelease];
 productImage.tag = PRODUCTIMAGELABEL_TAG;
 // Add the Image to the cell’s content view
 [cell.contentView addSubview:productImage];
 //CONFIGURE THE VNAME LABEL
 vLabel=[[[UILabel alloc]initWithFrame:CGRectMake(60, 18, 50, 18)]autorelease];
 vLabel.tag=VLABEL_TAG;
 vLabel.font=[UIFont systemFontOfSize:12.0];
 //ADD THE LABEL TO CELLS CONTACT VIEW
 [cell.contentView addSubview:vLabel];
 //add button in table view cell...

    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(0,0,50,60);
    [button setTag:indexPath.row+1];
    //[button setImage:[UIImage imageNamed:@"m1.png"] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(action:) forControlEvents:UIControlEventTouchUpInside];
    button.backgroundColor = [UIColor clearColor];
    [cell.contentView addSubview:button];


 }

 else {
 nameLabel=(UILabel*)[cell.contentView viewWithTag:NAMELABEL_TAG];
 valueLabel=(UILabel*)[cell.contentView viewWithTag:VALUELABEL_TAG];
 myPriceLabel=(UILabel*)[cell.contentView viewWithTag:MYPRICELABEL_TAG];
 savePriceLabel=(UILabel*)[cell.contentView viewWithTag:SAVEPRICELABEL_TAG];
 productImage = (UIImageView *)[cell.contentView viewWithTag:PRODUCTIMAGELABEL_TAG];
 vLabel=(UILabel*)[cell.contentView viewWithTag:VLABEL_TAG];
 yLabel=(UILabel*)[cell.contentView viewWithTag:YLABEL_TAG];
 sLabel=(UILabel*)[cell.contentView viewWithTag:SLABEL_TAG];
 }


 // Configure the cell...
 //mohit code start

 Product *pro = [self.products objectAtIndex:[indexPath row]];
 nameLabel.text = pro.name;
 valueLabel.text=[[NSNumber numberWithDouble:pro.value]stringValue];
 myPriceLabel.text=[[NSNumber numberWithDouble:pro.price]stringValue];
 savePriceLabel.text=[[NSNumber numberWithDouble:(pro.value-pro.price)]stringValue];
 vLabel.text=@"value Rs:";
 yLabel.text=@"your Price Rs:";
 sLabel.text=@"you Save Rs:";
 NSString *filePath = [[NSBundle mainBundle] pathForResource:pro.image
 ofType:@"png"];
 UIImage *image = [UIImage imageWithContentsOfFile:filePath];
 productImage.image = image;
 //cell.detailTextLabel.text=pro.value;
 /* 
 NSString *filepath=[[NSBundle mainBundle]pathForResource:pro.image ofType:@"png"];
 UIImage *image=[UIImage imageWithContentsOfFile:filepath];
 cell.imageView.image=image;
 */ 
//mohit code finish

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-27T06:26:58+00:00Added an answer on May 27, 2026 at 6:26 am

    I would look for processor intensive work happening elsewhere in your code since this much you have here looks straight forward. Look in other classes to see if you are doing expensive work on the main thread as that is the most likely source of slow scrolling. Do you have another view loaded perhaps? Is there some networking or database querying going on the main thread?

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

Sidebar

Related Questions

I'm using MVVM. <ItemsControl ItemsSource={Binding AllIcons} Tag={Binding}> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel> <Label HorizontalAlignment=Right>x</Label> <Image Source={Binding
I'm designing using IB a specific button (with some labels,and imageView and other stuff).
I want to set text field , uibutton, label and image view at the
I have created one button component using one Bitmap and one Label in it.
I am writing an image upload form using ASP.NET MVC 3. In the view,
I am trying to access some images for from image panel using a relative
I have a <button> with a nested image and I'm using jQuery to toggle
I am using Colorbox to load some content from an external (but local) file.
I'm using TableLayout for my swing GUI. Initially only some basic labels, buttons and
I created a label using Interface Builder, and now I want to set the

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.