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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:56:28+00:00 2026-05-17T22:56:28+00:00

Ive added a uiimageview as a subview to my cell.and then put a label

  • 0

Ive added a uiimageview as a subview to my cell.and then put a label on top of it so that it would seem like a button.But whwn the table is scrolled up or down the image seems to get painted again.This turns extremely ugly as my image has transparency effect which is lost as soon as it goes out of view and comes back.???

  • 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-17T22:56:29+00:00Added an answer on May 17, 2026 at 10:56 pm

    Ok, I’ll try to guess what your code looks like 🙂

    If images are painted multiple times that means you add them each time table view queries data source for a cell:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        UITableViewCell *cell = [tableView @"SomeID"];
        if (cell == nil) {
            // Create cell
        }
        UIImageView *imView = ... //Create and initialize view
        [cell.contentView addSubview:imView];
        ...
        return cell;
    }
    

    So each time your cell appears on screen (after user scrolls the table) new instance of image view is added to the cell. The correct approach is to add image view only once – when cell is created and then obtain and setup the existing image view:

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        UITableViewCell *cell = [tableView @"SomeID"];
        if (cell == nil) {
            // Create cell
            UIImageView *imView = ... //Create and initialize view
            imView.tag = 1000; // or any other int value
            [cell.contentView addSubview:imView];
        }
        UIImageView *iView = (UIImageView *)[cell.contentView viewWithTag:1000];
        iView.image = ...// set required image
        ...
        return cell;
    }
    

    So with this approach each time the cell is reused by table view the existing image view is populated with the image appropriate for the current row.

    I used a seperate identifier for each cell.

    Usually it is not a good idea – in this case table won’t be able to reuse its cells and you may get serious performance troubles

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

Sidebar

Related Questions

I am populating a UITableView with cells containing a UIImageView subview. I would like
I have a UIImageView that I've added a PinchGestureRecognizer to. Currently, the image is
So ive added a mapfield to my page. It creates everything you'd expect. ie.
I've added a cache.manifest in my application (this works perfectly) and since then, it's
I've added a callback to an IHTMLElement instance but when the IDispatch::Invoke is called
I've Added a setup project to my solution (didn't use the wizard) I then
I've added cookie support to SOAPpy by overriding HTTPTransport. I need functionality beyond that
I'm trying to add a subview to a UITableViewCell and the design that I'm
I have an application that appears to be executing all the code Ive given
i have a form that when submitted, if any field is empty id like

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.