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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:27:10+00:00 2026-05-20T15:27:10+00:00

My UITableView nedd to have, in the first row, an image. What’s the problem?

  • 0

My UITableView nedd to have, in the first row, an image.
What’s the problem? that when the user scrolls down the tableview and, after, he scrolls up, over the image there are the informations of the other rows!
Do you know why?

This is my code (i’m using a UITableViewCell)

- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row != 0) {
    return 73.0;
}
else {
    return 109.0;
}   
}

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

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    if (indexPath.row == 0) {
        [[NSBundle mainBundle] loadNibNamed:@"customcell_3" owner:self options:NULL];
        cell = cellaNib_with_image;
    }
    else {
        [[NSBundle mainBundle] loadNibNamed:@"customcell_2" owner:self options:NULL];
        cell = cellaNib;
    }


}

if (indexPath.row == 0) {
    UIImage *rowBackground;
    UIImage *selectionBackground;
    rowBackground = [UIImage imageNamed:@"image.png"];
    selectionBackground = [UIImage imageNamed:@"image.png"];
    cell.backgroundView = [[[UIImageView alloc] init] autorelease];
    ((UIImageView *)cell.backgroundView).image = rowBackground;
    cell.selectedBackgroundView = [[[UIImageView alloc] init] autorelease];
    ((UIImageView *)cell.selectedBackgroundView).image = selectionBackground;

}
else {
        NSString *elemento = [NSString stringWithFormat:@"%@", [array objectAtIndex:indexPath.row]];
    UILabel *testoLabel = (UILabel*)[cell viewWithTag:1];
    testoLabel.text = elemento;
//ecc... here a take the other datas
}
return cell;
}

Thanks!

  • 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-20T15:27:11+00:00Added an answer on May 20, 2026 at 3:27 pm

    When cells are scrolled, they are reused.

    So, first cell may be reused for other cells, and vice versa.

    I would use two CellIdentifiers, one for first row, and second for rest of the rows.

    If indexPath.row == 0, create/dequeue a cell using CellID1, and configure that and return.

    If indexPath.row >1, create/dequeue using CellID2, configure this and return.

    If you want to keep using single cellID, then before configuring them, nil/reset all the content first so that previous data are removed.

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

Sidebar

Related Questions

I have UITableView that contains many cell. User can expand cell to see more
I have a UITableView that I populate with data that i download over the
I have a UITableView that has a disclosure button on every row. When the
I have a UITableView that I have set-up with 2 sections. The code below
I have a UITableView with custom UITableViewCells. The table has two sections, the first
I have a UITableView that loads content into a UIWebView like this: //MainViewController.m -
I have a UITableView in a controller that is nested under a UITabBar .
I have a UITableView that is populated with cells by core data and an
Currently I have a UITableview, I have enough data that cannot be shown entirely
I have a UITableView cell with several UITextField s in it. When a user

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.