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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:33:51+00:00 2026-05-26T20:33:51+00:00

In a tableviewcell I have a UISlider. If I move the slider knob, go

  • 0

In a tableviewcell I have a UISlider. If I move the slider knob, go back to my previous view, and then return back to the table view, the knob on the slider returned back to zero but I see a “ghosting” of the knob where I had previously moved the slider too.

I clear the context view on the slider object in cellForRowAtIndexPath: and reload the table in viewDidAppear.

Anyone know how to fix this? It’s quite annoying. I put the slider code down below if that helps at all.

        // Setup slider
        CGRect sliderFrame = CGRectMake(15, 56, 230, 0);
        UISlider *slider = [[UISlider alloc] initWithFrame:sliderFrame];
        slider.clearsContextBeforeDrawing = YES;
        [slider addTarget:self action:@selector(sliderUpdated:) forControlEvents:UIControlEventValueChanged];
        [slider addTarget:self action:@selector(sliderStopped:) forControlEvents:UIControlEventTouchUpInside];
        [cell.contentView addSubview:slider];
        [slider release];

I appreciate it! 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-26T20:33:52+00:00Added an answer on May 26, 2026 at 8:33 pm

    It is most likely that you are creating a new UISlider over the old UISlider which gives the ghosting effect.

    Two possible solutions

    1. Tag the UISlider when you add it to a cell.

    2. Subclass UITableViewCell and add a UISlider to it’s content view and keep a reference to it with an ivar.

    To do 1 simply tag the UISlider when you add it to the contentView. Then when you get a cell again you try getting the view back first or you create it a fresh.

    const int sliderViewTag = 99;
    
    UISlider *slider = [cell.contentView viewWithTag:sliderViewTag];
    
    if (!slider) {
      CGRect sliderFrame = CGRectMake(15, 56, 230, 0);
      slider = [[UISlider alloc] initWithFrame:sliderFrame];
      slider.clearsContextBeforeDrawing = YES;
      [slider addTarget:self action:@selector(sliderUpdated:) forControlEvents:UIControlEventValueChanged];
      [slider addTarget:self action:@selector(sliderStopped:) forControlEvents:UIControlEventTouchUpInside];
      [cell.contentView addSubview:slider];
      [slider release]; slider = nil;
    }
    

    Although 2 is a little more involved it is my preferred method but I am sure there are some great examples of how to do it. There is some great docs by Apple so check them out Table View Programming Guide specifically look at the section A Closer Look at Table-View Cells

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

Sidebar

Related Questions

I am deriving from TableViewCell. When i query the table view about an index
I have a view with a custom slider. We are using a subclass of
I want to use the scroll view inside the tableviewcell. I have written the
previously i had custom tableviewcell and was loading from Nib.in that i have specified
I have a TableViewCell with a UISwitch in accessoryView. I don't want that blue
I am trying to have custom TableViewCell with initWithStyle, since it says initWithFrame is
I have a custom tableviewcell with a label and a textfield. Right now if
I have UIImageView in a custom TableViewCell . I load an image in it
I have a simple tableViewCell build in interface builder. It contains a UIView which
I have a spliviewcontroller based ipad application. When the tableviewcell is selected from rootviewcontroller

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.