2

i would like to ask you, if somebody know how to create a shadow at the end of table view as it is shown in the image bellow (click on the href :)). Best regards

Martin

App with shadow

  • refer this and see if it helps// http://stackoverflow.com/questions/5000354/how-to-fade-the-content-of-cell-of-table-view-which-reaches-at-the-top-while-scr – Ankit Srivastava May 28 '12 at 08:53

1 Answers1

2

The code for the top gradient, don't forget to import QuartzCore/QuartzCore.h The .view is view controllers outlet View (UIView), the table view is it's subview.

- (void)viewDidLoad
{
    UIView *gradientView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 50)] autorelease];
    CAGradientLayer *gradient = [CAGradientLayer layer];
    [gradient setFrame:gradientView.bounds];
    gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor blackColor] CGColor], (id)[[UIColor clearColor] CGColor], nil];
    [self.view.layer addSublayer:gradient];
    [super viewDidLoad];
}

Or you can always draw the gradient image and add it as a subview (on the root view after the scroll view, not on the scroll view directly to prevent the image from scrolling).

A-Live
  • 8,904
  • 2
  • 39
  • 74