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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:58:28+00:00 2026-06-11T04:58:28+00:00

i am using uitableview and i am facing a problem in cellforrow delegate i

  • 0

i am using uitableview and i am facing a problem in cellforrow delegate i use this code

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"mycell";
CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (cell == nil) {
    NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
    cell =  (CustomCell *)[topLevelObjects objectAtIndex:2];
    cell.btn_Selected.hidden=YES;
    cell.btn_Selected.tag=indexPath.row+1;

    [array_btnContainer addObject:cell.btn_Selected];

}

my problem is that when i run app it load my table view and create cells but when i scroll my table view it creates one more cell why ????
it must reuse the already created cell and not to enter (cell==nil) block but when ever i scroll it creates one cell and reuse other cell why???? i am stuck

  • 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-11T04:58:29+00:00Added an answer on June 11, 2026 at 4:58 am

    This can be achieved via following these steps

    1. Create a reference of your CustomCell in .h file which you are using to show the tableview whatever it is lets called it ShowTableView.h.
      IBOutlet CustomCell *cell;

    2. Go to CustomCell.xib and select the fileowner then set the class property as ShowTableView.

    3. Attached the cell reference with the CustomCell

    4. Select the CustomCell and then set property Identifier value with mycell

    5. Now go to your ShowTableView.m file and cellForRowAtIndexPath method place this code:

       -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:      (NSIndexPath *)indexPath
      {
      
      static NSString *kCellIdentifier = @"mycell";
      cell =(CustomCell *)[tableView dequeueReusableCellWithIdentifier:kCellIdentifier];
      if (!cell)
      {
      [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];      
      }  
      }
      

    Now it will reuse your previous cells

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

Sidebar

Related Questions

I am setting the row height of my UITableView using following code [tableView setRowHeight:
I'm using Indexed UITableView by implementing the following delegate methods: - (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString
I am using a static UITableview, set up in a storyboard. For some cells
This is the problem I'm facing right now: I've got a lot of UITableViews
I am using UITableView in my application. I am using the cellForRowAtIndexPath method of
I am using an UITableView to show some string messages, and I use NSOperationQueue
I have problems using this UITableView method : - (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation First the
I am using custom UITableview concept to show data in cell of tableview. My
When using UITableView, we can reuse its cells using [[ UITableViewCell alloc] initWithStyle: reuseIdentifier:]
I am using a UITableView and the cells I am using in this 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.