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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:10:24+00:00 2026-06-06T16:10:24+00:00

In one part of my code, i call UITableViewCell *cell = (UITableViewCell *)[self.tableView cellForRowAtIndexPath:indexPath];

  • 0

In one part of my code, i call

UITableViewCell *cell = (UITableViewCell *)[self.tableView cellForRowAtIndexPath:indexPath];

to get a number of cells, and then I change their alphas to .35. This works, and the cells look faded.

However, when I scroll the tableview, the cells that move out of the window and then move back are no longer are faded. This happens even though in cellForRowAtIndexPath the alpha for each disabled row is set to .35.

Right before returning the cells in cellForRowAtIndexPath I log

NSLog(@"%f", cell.alpha);

And it returns .35

However, the cell is not faded after scrolling? It appears as if it’s alpha magically gets changed back to 1 before being displayed.

Following is my implementation of cellForRowAtIndexPath in my Section class

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

if ([self disabled]) 
{
    cell = [SectionedTableViewController tableView:tableView dequeueReusableCellWithIdentifier:@"CellDisabled" style:UITableViewCellStyleDefault];
    cell.alpha = .35;
}
else
{
    cell = [SectionedTableViewController tableView:tableView dequeueReusableCellWithIdentifier:@"CellEnabled" style:UITableViewCellStyleDefault];
    cell.alpha = 1;
}

cell.selectionStyle = UITableViewCellSelectionStyleNone;

//if-else block that only sets labels is here omitted

if (cell.textLabel.text == [[cs objectAtIndex:[self c]] type])
{
    cell.accessoryType = UITableViewCellAccessoryCheckmark;
}

NSLog(@"%f", cell.alpha);

return cell;

}

And the view controller that coordinates these sections gets cells from them like so:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"Alpha: %f", [[[self sections] objectAtIndex:indexPath.section] tableView:tableView cellForRowAtIndexPath:indexPath].alpha);
    return [[[self sections] objectAtIndex:indexPath.section] tableView:tableView cellForRowAtIndexPath:indexPath];
}

(and the NSLog is logging appropriate alpha values)

  • 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-06-06T16:10:27+00:00Added an answer on June 6, 2026 at 4:10 pm

    This issue is probably due to cells being reused in the table view. There is a better way to do this:

    You should create an NSMutableDictionary in your view controller and just set keys for the indexes that should be faded.

    Then, in cellForRowAtIndexPath, while you are setting up the cell, set the alpha based on whether or not the index exists as a key in the dictionary.

    This solution will work without any weird behavior.

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

Sidebar

Related Questions

I have some code that at one part will get executed a lot, and
I'm stuck on one thing i can't get solved. I have part of code,
In one part of my code, I call getContext('2d') on a canvas element to
Using linkedin-j , I have the following code in one part of my application
I'm currently attempting to code one for part of a college project - binary/hex
I'm making one part in my app where if you push the button then
Suppose I have some class MyClass. In one part of my code I want
one part of my applikation covers an MkMapview. Therefore i load a list of
MySqlDb is a fantastic Python module -- but one part is incredibly annoying. Query
I want to relocate some controls from one part in the visual tree to

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.