From 4a42dbf1a0b34ec429af54c8e01fc8be08326288 Mon Sep 17 00:00:00 2001 From: Richard Hult Date: Sun, 30 Sep 2012 17:52:04 +0200 Subject: [PATCH] Adapt the demo to show the backView below the background view --- .../ZKRevealingTableViewController.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ZKRevealingTableViewCell/ZKRevealingTableViewController.m b/ZKRevealingTableViewCell/ZKRevealingTableViewController.m index 8749ece..6c262f9 100644 --- a/ZKRevealingTableViewCell/ZKRevealingTableViewController.m +++ b/ZKRevealingTableViewCell/ZKRevealingTableViewController.m @@ -44,6 +44,7 @@ - (void)viewDidLoad // Do any additional setup after loading the view, typically from a nib. self.objects = [NSArray arrayWithObjects:@"Right", @"Left", @"Both", @"None", nil]; self.tableView = (UITableView *)self.view; + self.tableView.backgroundColor = [UIColor clearColor]; self.tableView.rowHeight = 52.0f; self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; } @@ -135,8 +136,12 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell = [[ZKRevealingTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"]; cell.delegate = self; cell.selectionStyle = UITableViewCellSelectionStyleNone; - - cell.backView.backgroundColor = [UIColor scrollViewTexturedBackgroundColor]; + + cell.backgroundView = [[UIView alloc] initWithFrame:CGRectZero]; + + cell.backView = [[UIView alloc] initWithFrame:CGRectZero]; + cell.backView.backgroundColor = [UIColor scrollViewTexturedBackgroundColor]; + cell.pixelsToReveal = 40; } @@ -165,9 +170,9 @@ - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)ce { NSUInteger row = [indexPath row]; if (row % 2 == 0) { - cell.backgroundColor = [UIColor whiteColor]; + cell.backgroundView.backgroundColor = [UIColor whiteColor]; } else { - cell.backgroundColor = [UIColor colorWithRed:0.892 green:0.893 blue:0.892 alpha:1.0]; + cell.backgroundView.backgroundColor = [UIColor colorWithRed:0.892 green:0.893 blue:0.892 alpha:1.0]; } // cell.contentView.backgroundColor = cell.backgroundColor;