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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:52:28+00:00 2026-06-02T13:52:28+00:00

I am having a table view with 5 sections each section contains a only

  • 0

I am having a table view with 5 sections each section contains a only 1 row each row displays a customized cell. Everything is working properly but section zero is repeating at section four I am not able to trace this. This is my code.

-(void) setUpActivityView {
    [self createViews];
}


#pragma  mark Table View methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 5;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    if (indexPath.section == 0) { 
        return 167;
    }
    else if (indexPath.section == 1) {
        return 200;
    }
    else if (indexPath.section == 2) {
        return 115;
    }
    else if (indexPath.section == 3) {
        return 90;
    }
    else {
        return 155;
    }

}


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

    static NSString *CellIdentifier = @"customCellIdentifier";

    if (indexPath.section == 0 && indexPath.row == 0) {
        _notificationCell = (NotificationsCustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

        if (_notificationCell == nil) {
            _notificationCell = [[[NotificationsCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];

        }

        _notificationCell.selectionStyle = UITableViewCellSelectionStyleNone;

        return _notificationCell;
    }
    else if (indexPath.section == 1 && indexPath.row == 0) {
         _topMatchCell = (TopMatchCustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

        if (_topMatchCell == nil) {
            _topMatchCell = [[[TopMatchCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];   
        }

        _topMatchCell.selectionStyle = UITableViewCellSelectionStyleNone;

        return _topMatchCell;
    }
    else if (indexPath.section == 2 && indexPath.row == 0) {
        _recentlyViewedCell = (RecentlyViewedHomesCustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

        if (_recentlyViewedCell == nil) {
            _recentlyViewedCell = [[[RecentlyViewedHomesCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        }

        _recentlyViewedCell.selectionStyle = UITableViewCellSelectionStyleNone;

        return _recentlyViewedCell;
    } else if (indexPath.section == 3 && indexPath.row == 0) {
        _feedbackCell = (FeedbackCustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

        if (_feedbackCell == nil) {
            _feedbackCell = [[[FeedbackCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        }

        _feedbackCell.selectionStyle = UITableViewCellSelectionStyleNone;

        return _feedbackCell;
    }
    else {
        _activityTimeLineCell = (ActivityTimeLineCustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

        if (_activityTimeLineCell == nil) {
            _activityTimeLineCell = [[[ActivityTimeLineCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        }

        _activityTimeLineCell.selectionStyle = UITableViewCellSelectionStyleNone;

        return _activityTimeLineCell;
   }
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

}


- (void)initializeSubViews {
    _mainTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 412) style:UITableViewStylePlain];
}


- (void)configureLayoutOfSubViews {
    self._mainTableView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Home_Setup1-bg.png"]];
//    UIColor *lSeperatorColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"line_bg.png"]];
//    [self._mainTableView setSeparatorColor:lSeperatorColor];
}


- (void)setStylesForSubViews {
    _mainTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    _mainTableView.showsVerticalScrollIndicator = NO;
    _mainTableView.scrollsToTop = NO;
}

- (void)setStateForSubViews {

}

- (void)registerTargets {
    _mainTableView.delegate = self;
    _mainTableView.dataSource = self;
}

-(void)addToParentsView {
     [self addSubview:_mainTableView];
}

-(void) createViews {
    [self initializeSubViews];
    [self configureLayoutOfSubViews];
    [self setStylesForSubViews];
    [self setStateForSubViews];
    [self registerTargets];
    [self addToParentsView];
}
  • 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-02T13:52:30+00:00Added an answer on June 2, 2026 at 1:52 pm

    Use different cell identifiers for different cells. As new cells scroll into your view, old cells that scrolled out of your view will be reused based on the identifier you provide on dequeueing.

    Let me guess, on load your fifth cell is not within your view?

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

Sidebar

Related Questions

I want each row of my table view to appear, as it's own independent
I have a table view that is managed by an NSFetchedResultsController. I am having
I'm having a table and i have a row which is initially set to
I've a question about printing text in header and footer of table view section.
So I have my UITableView, with 2 sections and 1 cell in each, and
In my iPhone app, I am having a grouped table view. I have used
I am having a table view with default UITableViewCell of style UITableViewCellStyleValue2. I just
I'm trying to get a specific cell from a table view so I can
I have one problem with two sections in UITableview grouped style. First section having
Problem: When I click the delete button for a given table/section row, i get

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.