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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:34:21+00:00 2026-05-19T23:34:21+00:00

i am working on an iphone project that shows an artwork at the top

  • 0

i am working on an iphone project that shows an artwork at the top tableview section (section 0) and shows a list of items in (section 1). the tableview looks like that:

section0:

ARTWORK IMAGE

section1:

cell1: text1

cell2: text2

.
.
. and so goe like that.

but strangely the program shows another imageview at the bottom of the page when i scroll down, but it shouldnt show that image because its not section 0.

heres the code for my program :

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 2;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
switch (section) {
    case 0:
        return 1;
        break;
    case 1:
        return [diskArray count];
        break;
    default:
        return 0;
        break;
}
}

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

switch (indexPath.section) {
    case 0:
        return 225;
        break;
    default:
        return 44;
        break;
}

}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

static NSString *CellIdentifier = @"Cell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
if(indexPath.section == 0)
{
    if(indexPath.row == 0)
    {
    NSLog(@"adding image to the cell");
    UIImage *img = [UIImage imageNamed:@"artwork.jpeg"];
    UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(47, 0, 225, 225)];
    imgView.image = img;
    [cell addSubview:imgView];
    [imgView release];
    cell.backgroundColor = [UIColor clearColor];
    cell.textLabel.text = nil;
    }
}
else if(indexPath.section == 1){
    cell.textLabel.text = [diskArray objectAtIndex:indexPath.row];
    cell.backgroundColor = [UIColor darkGrayColor];
    cell.textLabel.textColor = [UIColor whiteColor];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}

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-19T23:34:21+00:00Added an answer on May 19, 2026 at 11:34 pm

    The iPhone reuses old cells with the subview you’ve added. Try changing the CellIdentifier for each section.

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

Sidebar

Related Questions

The Project I'm working on a relatively simple iPhone OS project that's navigation controller
I am currently working on a project for the iPhone that requires accessing a
I have an existing working iPhone project inside XCode 4.2. I localized an image
I'm working on an iPhone project where I would like to retrieve an object
I am working in a iPhone project that uses restful web services. I need
I'm working on an iPhone project that needs to receive data from a PHP
I'm working on an iPhone project in which the developer that created it has
I'm working on a project for iphone and android browsers that requires that I
I have an iPhone (Xcode) Project that was working fine. Something must have been
I'm working on a iPhone offline map project. So i would like to generate

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.