Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Optimization: don't issue GET for every row displayed

Get the value of the 'check' and 'text' properties from the row's value rather than fetching the whole document.
  • Loading branch information...
commit 5a278fb0f646e5b878565f13733e5461a1028a72 1 parent 1741144
@snej snej authored
Showing with 6 additions and 5 deletions.
  1. +1 −1  Resources/CouchDemo-Info.plist
  2. +5 −4 Source/RootViewController.m
View
2  Resources/CouchDemo-Info.plist
@@ -50,7 +50,7 @@
<key>CFBundleSignature</key>
<string>codm</string>
<key>CFBundleVersion</key>
- <string>103</string>
+ <string>105</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSMainNibFile</key>
View
9 Source/RootViewController.m
@@ -129,12 +129,13 @@ - (void)couchTableSource:(CouchUITableSource*)source
cell.textLabel.font = [UIFont fontWithName: @"Helvetica" size:18.0];
cell.textLabel.backgroundColor = [UIColor clearColor];
- // Configure the cell contents:
- NSDictionary* properties = row.document.properties;
- BOOL checked = [[properties valueForKey:@"check"] boolValue];
+ // Configure the cell contents. Our view function (see above) copies the document properties
+ // into its value, so we can read them from there without having to load the document:
+ NSDictionary* properties = row.value;
+ BOOL checked = [[properties objectForKey:@"check"] boolValue];
UILabel *labelWithText = cell.textLabel;
- labelWithText.text = [properties valueForKey:@"text"];
+ labelWithText.text = [properties objectForKey:@"text"];
labelWithText.textColor = checked ? [UIColor grayColor] : [UIColor blackColor];
[cell.imageView setImage:[UIImage imageNamed:
Please sign in to comment.
Something went wrong with that request. Please try again.