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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:56:35+00:00 2026-06-02T05:56:35+00:00

I created a uitableview and when i launch it, it looks as it is

  • 0

I created a uitableview and when i launch it, it looks as it is supposed to, but when I scroll, it puts text in all the other sections that I don’t specify, can someone please help.
The first image attached is how it should look. The second it what it does when I scroll.

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if (section == 0 ){
        return 1;}
    else if (section == 1){
        return [cellLabels count];
    }else if (section == 2){
        return 1;
    }else{
        return 0;
    }

}

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

    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
    }
    tableView.showsVerticalScrollIndicator = NO;
    // cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;


    if( indexPath.section == 0 )
    {
    }
    else if (indexPath.section == 1)
    {
        cell.textLabel.backgroundColor = [UIColor clearColor];
        cell.textLabel.textColor = [UIColor blackColor];
        // headerLabel.font = [UIFont SystemFontOfSize:16];
        [cell.textLabel setFont:[UIFont fontWithName:@"Arial" size:14]];
        cell.textLabel.text = [cellLabels objectAtIndex:indexPath.row];


    }
return cell;

}

This is what is looks like when it is launched, and what it is supposed to look like

enter image description here

  • 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-02T05:56:37+00:00Added an answer on June 2, 2026 at 5:56 am

    your problem is pretty simple ,

    since table view reuses allocated cells,
    when it comes to first time to first section your displaying nothing , in second section displaying your custom texts

    when it scrolls down and come back it text will appear in first section because when it reaches

    if( indexPath.section == 0 )
    {
    }
    

    it wont do anything so

    make it

    if( indexPath.section == 0 )
    {
       cell.textLabel.text = @"";
    }
    else if( indexPath.section == 2 )
    {
       cell.textLabel.text = @"";
    }
    

    or

    if( indexPath.section == 0 )
    {
       cell.textLabel.text = nil;
    }
    
    else if( indexPath.section == 2 )
    {
       cell.textLabel.text = nil;
    }
    

    other FOR SECTION 1 is correct

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

Sidebar

Related Questions

I have a view that was created with all of the default UITableView stuff,
I have a TabBar App. I have created a UITableView class called Schedule that
I have a UITableView that was created from data coming from a mutable array.
I have created a UITableView that is of type UITableViewStyleGrouped . I have then
I have successfully created a UITableView/UITableViewCell that is able to slide up and down
I have created a UITableView with 4 Sections and 3 Rows so totally 12
I have a ViewController that contains a UITableView in which the cells are created
I have created an editable UITableView that supports several custom UITableViewCells of my own
Assuming self.tableView is a UITableView instance variable that I created, can anyone explain the
I created a UITableView programmatically, but none of its methods were called. I must

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.