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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:47:06+00:00 2026-05-27T22:47:06+00:00

I filled my tableView with a background view (gradient) unfortunately, only half of the

  • 0

I filled my tableView with a background view (gradient) unfortunately, only half of the background is filled.

Any ideas how to fill the second half?

Big thanks in advance!

Code:

UIView* myView = [[GradientBackground alloc] initWithFrame:CGRectMake(self.view.bounds.origin.x, self.view.bounds.origin.y, self.view.bounds.size.width,  self.view.bounds.size.height)];

myTableView.backgroundColor = [UIColor clearColor];

myTableView.backgroundView = myView;

and Gradientbackground.m

- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
    // Initialization code
}
return self;
}

- (void)drawRect:(CGRect)rect 
{
CGContextRef currentContext = UIGraphicsGetCurrentContext();       
CGGradientRef glossGradient;
CGColorSpaceRef rgbColorspace;
size_t num_locations = 2;
CGFloat locations[2] = { 0.0, 1.0 };
CGFloat components[8] = {  25.0 / 255.0, 89.0 / 255.0, 140.0 / 255.0, 0.65,  // Start color
25.0 / 255.0, 89.0 / 255.0, 140.0 / 255.0, 1.0 }; // End color


//( 25.0 / 255.0 ) green:( 89.0 / 255.0 ) blue:( 140.0 / 255.0 )

rgbColorspace = CGColorSpaceCreateDeviceRGB();
glossGradient = CGGradientCreateWithColorComponents(rgbColorspace, components, locations, num_locations);

CGRect currentBounds = self.bounds;
CGPoint topCenter = CGPointMake(CGRectGetMidX(currentBounds), 0.0f);
CGPoint midCenter = CGPointMake(CGRectGetMidX(currentBounds), CGRectGetMidY(currentBounds));
CGContextDrawLinearGradient(currentContext, glossGradient, topCenter, midCenter, 0);

CGGradientRelease(glossGradient);
CGColorSpaceRelease(rgbColorspace); 
} 

25.0 / 255.0, 89.0 / 255.0, 140.0 / 255.0, 1.0 }; // End color


//( 25.0 / 255.0 ) green:( 89.0 / 255.0 ) blue:( 140.0 / 255.0 )

rgbColorspace = CGColorSpaceCreateDeviceRGB();
glossGradient = CGGradientCreateWithColorComponents(rgbColorspace, components, locations, num_locations);

CGRect currentBounds = self.bounds;
CGPoint topCenter = CGPointMake(CGRectGetMidX(currentBounds), 0.0f);
CGPoint midCenter = CGPointMake(CGRectGetMidX(currentBounds), CGRectGetMidY(currentBounds));
CGContextDrawLinearGradient(currentContext, glossGradient, topCenter, midCenter, 0);

CGGradientRelease(glossGradient);
CGColorSpaceRelease(rgbColorspace); 

enter image description here

  • 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-27T22:47:06+00:00Added an answer on May 27, 2026 at 10:47 pm

    Got it. My code for the gradient was wrong. I used the mid of the view, but the gradient was supposed to end at the bottom.

    rgbColorspace = CGColorSpaceCreateDeviceRGB();
    glossGradient = CGGradientCreateWithColorComponents(rgbColorspace, components, locations, num_locations);
    
    CGRect currentBounds = self.bounds;
    CGPoint topCenter = CGPointMake(CGRectGetMidX(currentBounds), CGRectGetMaxY(currentBounds));
    CGPoint bottomCent = CGPointMake(CGRectGetMidX(currentBounds), CGRectGetMinY(currentBounds));
    CGContextDrawLinearGradient(currentContext, glossGradient, topCenter, bottomCent, 0);
    
    CGGradientRelease(glossGradient);
    CGColorSpaceRelease(rgbColorspace);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Little background, the table view is filled by a fetchedResultsController which fills the table
I have a NSMutableArray filled with NSMutableArray's. I would like to fill my table
In my app I have a tableView filled with contents from a server. To
I have a sectioned tableview with a plist wich is an array filled with
I have a tableview which gets filled by a StreamingXMLParser (https://github.com/AlanQuatermain/aqtoolkit). When I run
I've got a tableView, with custom cells being filled by NSMutableDictionaries, inside an NSMutableArray.
In my app I have a tableview being filled by values from an NSMutableArray.
Once an array is properly filled, when I call it again using tableview reload,
Hi I currently have a table view which is being filled via Core Data.
I have filled List<Object1> Object 1 contain 2 fields (int id & string name)

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.