Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- static NSString *cellIdentifier = @"cell";
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"myTableViewCell" forIndexPath:indexPath];
- cell.layer.shouldRasterize = YES;
- cell.layer.rasterizationScale = [UIScreen mainScreen].scale;
- cell.layer.shadowColor = [[UIColor blackColor] CGColor];
- cell.layer.shadowOffset = CGSizeMake(0.0f, 0.0f);
- cell.layer.shadowRadius = 1.0f;
- cell.layer.shadowOpacity = 1.0f;
- CGPathRef shadowPath = [UIBezierPath bezierPathWithRect:cell.bounds].CGPath;
- cell.layer.shadowPath = shadowPath;
- return cell;
- }
- - (UIView*)shadowWithRect:(CGRect)rect {
- UIView* v = [[UIView alloc] initWithFrame:rect];
- CAGradientLayer *gradient = [CAGradientLayer layer];
- gradient.frame = v.bounds;
- gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor blackColor] CGColor], (id)[[UIColor clearColor] CGColor], nil];
- [v.layer insertSublayer:gradient atIndex:0];
- return v;
- }
- - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
- static NSString *cellIdentifier = @"shadowCell";
- UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
- [cell addSubview:[self shadowWithRect:cell.bounds]];
- return cell;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement