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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:15:38+00:00 2026-05-23T20:15:38+00:00

I inserted this gradient coce into my cellForRowAtIndexPath method, but it does weird things.

  • 0

I inserted this gradient coce into my cellForRowAtIndexPath method, but it does weird things. when I continuesly scroll up and down the page, it paints over and over the cells, so page gets darker and darker. Shold I put this somewhere else?

- (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];
}

    //NSString *cellValue=[variable object ]
    // Configure the cell...

NSString *cellValue = [items objectAtIndex:indexPath.row];

if (indexPath.row==0){


    cell.textLabel.text=cellValue;
        //cell.textLabel.font=bold;
    cell.textLabel.font = [UIFont fontWithName:@"Georgia" size:11];

    cell.textLabel.font = [UIFont boldSystemFontOfSize:(CGFloat)16];


}
else {

    cell.textLabel.text=cellValue;
        //cell.textLabel.font=bold;
    cell.textLabel.font = [UIFont fontWithName:@"Georgia" size:14];

}

UIView *myBackView = [[UIView alloc] initWithFrame:cell.frame];
UIColor *color = [UIColor colorWithHue:0.56f  saturation:0.98 brightness:0.65 alpha:0.5];
UIColor *colorWhite = [UIColor colorWithHue:0.0f  saturation:0.0 brightness:0.95 alpha:0.5];
UIColor *colorBlack = [UIColor colorWithHue:1  saturation:1 brightness:0 alpha:0.2];


myBackView.backgroundColor=color;
UIColor *textColor = [UIColor colorWithHue:0.0f  saturation:0.0 brightness:0.95 alpha:1];

cell.selectedBackgroundView = myBackView;
cell.selectedTextColor=textColor;
[myBackView autorelease];


UIView *cellView = [[UIView alloc] initWithFrame:cell.frame];
                CAGradientLayer *gradient = [CAGradientLayer layer];
                gradient.frame = cellView.bounds;
                gradient.startPoint = CGPointMake(0, 0.5);
                gradient.endPoint = CGPointMake(1.0, 0.5);
                gradient.colors = [NSArray arrayWithObjects:(id)[colorBlack CGColor], (id)[colorWhite CGColor], nil];
                [cell.layer insertSublayer:gradient atIndex:0];

[cellView autorelease];


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-23T20:15:39+00:00Added an answer on May 23, 2026 at 8:15 pm

    Your code looks like isn’t complete, but you’re inserting a layer EVERY time the table view requests a cell.

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

Sidebar

Related Questions

I'm using the following code: INSERT INTO tForeignLanguage ([Name]) VALUES ('Араб') this value inserted
I installed the yoogallery plugin and inserted this into my articles: {yoogallery src=[/images/stories/inscheping/]} this
I inserted this code to build a thumb gallery but it messed up my
I inserted some values into a table. There is a column whose value is
If user input is inserted without modification into an SQL query, then the application
I've inserted a UITableViewController and it's corresponding UITableView into a simple IB document. The
Does std::map move around already inserted values when inserting new data ?
I inserted this timestamp as part of the blogger query: http://www.blogger.com/feeds/26861498/posts/default?published-min=1937-01-01T12:00:27.87+08:00 It returned me
I have inserted this in settings.py: AUTHENTICATION_BACKENDS = ( 'blog.auth.backends.EmailBackend', 'django.contrib.auth.backends.ModelBackend', ) blog is
This works, does anyone see anything I shouldn't be doing? My function that is

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.