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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:39:18+00:00 2026-05-18T08:39:18+00:00

i have following code to create cell and add image to it UIImageView* MyImage

  • 0

i have following code to create cell and add image to it

UIImageView* MyImage =[[UIImageView alloc]initWithFrame:CGRectMake(100,10,40,40)];  
[MyImage setImage:[UIImage imageNamed:[imageArray objectAtIndex:indexPath.row]]];  
[MyImage setBackgroundColor:[UIColor clearColor]];  
[cell addSubview:MyImage];  
[MyImage release];  

cell.textLabel.text=[dataArray objectAtIndex:indexPath.row];  
     return cell;

I am using this table for many purposes and therefore refreshing it again and again….
Therefore next i age overlaps the last one due to which problem occurs and both of these images are visible(i am using transparent background for each image)…. other problem occurs when i need no image..here i am unable to remove the last image …

please help

  • 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-18T08:39:18+00:00Added an answer on May 18, 2026 at 8:39 am

    As you might be aware that when you reuse cell from ‘dequeueReusableCellWithIdentifier’, it returns you existing cell instance if present, that means if cell exist its data also exists i.e. image, so you need to clear the old image before updating the cell with new data as if new data doesn’t have image then it will show old image, I guess you got the point…

    Ok here is the solution:

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if(cell==nil)
    {
       cell = [[UITableViewCell alloc] initWithStyle:UITableViewStyleDefault reuseIdentifier:cellIdentifier];
    
       UIImageView* MyImage =[[UIImageView alloc]initWithFrame:CGRectMake(100,10,40,40)]; 
       MyImage.tag = 1000; 
    
       [MyImage setBackgroundColor:[UIColor clearColor]];  
       [cell addSubview:MyImage];  
       [MyImage release]; 
    }
    UIImageView *imgView = (UIImageView*)[cell viewWithTag:1000];
    imgView.image = nil;
    imgView.image = [UIImage imageNamed:[imageArray objectAtIndex:indexPath.row]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code to create a UIPickerView: pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0f,
I have created the following stored procedure.. CREATE PROCEDURE [dbo].[UDSPRBHPRIMBUSTYPESTARTUP] ( @CODE CHAR(5) ,
I have used following code to create a simple PDF file. It executes fine
C# or VB.NET suggestion are welcome. I have the following code to create Excel
I have the following controller code: def create @admin = Admin.new(params[:admin]) respond_to do |format|
I have the following code to create a new calendar for a gmail contact:
I have the following code that creates two objects (ProfileManager and EmployerManager) where the
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public
I have following Code Block Which I tried to optimize in the Optimized section
I'm trying to use opengl in C#. I have following code which fails with

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.