瀏覽代碼

Dropbox: adapt table view appearance to match the library

Felix Paul Kühne 12 年之前
父節點
當前提交
c37f5796ec
共有 2 個文件被更改,包括 7 次插入8 次删除
  1. 0 7
      AspenProject/VLCDropboxTableViewCell.m
  2. 7 1
      AspenProject/VLCDropboxTableViewController.m

+ 0 - 7
AspenProject/VLCDropboxTableViewCell.m

@@ -16,13 +16,6 @@
     NSAssert([nibContentArray count] == 1, @"meh");
     NSAssert([[nibContentArray lastObject] isKindOfClass:[VLCDropboxTableViewCell class]], @"meh meh");
     VLCDropboxTableViewCell *cell = (VLCDropboxTableViewCell *)[nibContentArray lastObject];
-    CGRect frame = [cell frame];
-    UIView *background = [[UIView alloc] initWithFrame:frame];
-    background.backgroundColor = [UIColor colorWithWhite:.05 alpha:1.];
-    cell.backgroundView = background;
-    UIView *highlightedBackground = [[UIView alloc] initWithFrame:frame];
-    highlightedBackground.backgroundColor = [UIColor colorWithWhite:.2 alpha:1.];
-    cell.selectedBackgroundView = highlightedBackground;
 
     return cell;
 }

+ 7 - 1
AspenProject/VLCDropboxTableViewController.m

@@ -65,7 +65,8 @@
     self.navigationItem.titleView.contentMode = UIViewContentModeScaleAspectFit;
 
     self.tableView.rowHeight = [VLCDropboxTableViewCell heightOfCell];
-    self.tableView.separatorColor = [UIColor colorWithWhite:.2 alpha:1.];
+    self.tableView.separatorColor = [UIColor colorWithWhite:.122 alpha:1.];
+    self.view.backgroundColor = [UIColor colorWithWhite:.122 alpha:1.];
 
     _numberOfFilesBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:[NSString stringWithFormat:NSLocalizedString(@"NUM_OF_FILES", @""), 0] style:UIBarButtonItemStylePlain target:nil action:nil];
     [_numberOfFilesBarButtonItem setTitleTextAttributes:@{ UITextAttributeFont : [UIFont systemFontOfSize:11.] } forState:UIControlStateNormal];
@@ -160,6 +161,11 @@
 
 #pragma mark - Table view delegate
 
+- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    cell.backgroundColor = (indexPath.row % 2 == 0)? [UIColor blackColor]: [UIColor colorWithWhite:.122 alpha:1.];
+}
+
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
     DBMetadata *selectedFile = _dropboxController.currentListFiles[indexPath.row];