diff options
author | Hoà V. DINH <dinh.viet.hoa@gmail.com> | 2013-07-17 14:01:19 -0700 |
---|---|---|
committer | Hoà V. DINH <dinh.viet.hoa@gmail.com> | 2013-07-17 14:01:19 -0700 |
commit | c2f75bfae0ae58be952c2abc07d90ead01e1ed89 (patch) | |
tree | d8b5e29de04b3059be461a03b7b54c1bdbb47e27 /example/ios/iOS UI Test/iOS UI Test/MasterViewController.m | |
parent | df1f253e6428f8fd6805e1e2492399efb95fdee9 (diff) | |
parent | 739398c238744901170a3800bd3d19f3ad584911 (diff) |
Merge pull request #191 from paulyoung/message-preview-in-examples
Add message preview to iOS example.
Diffstat (limited to 'example/ios/iOS UI Test/iOS UI Test/MasterViewController.m')
-rw-r--r-- | example/ios/iOS UI Test/iOS UI Test/MasterViewController.m | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/example/ios/iOS UI Test/iOS UI Test/MasterViewController.m b/example/ios/iOS UI Test/iOS UI Test/MasterViewController.m index 5bbc0d53..7540eee8 100644 --- a/example/ios/iOS UI Test/iOS UI Test/MasterViewController.m +++ b/example/ios/iOS UI Test/iOS UI Test/MasterViewController.m @@ -11,6 +11,7 @@ #import "FXKeychain.h" #import "MCTMsgViewController.h" #import "GTMOAuth2ViewControllerTouch.h" +#import "MCTTableViewCell.h" #define CLIENT_ID @"the-client-id" #define CLIENT_SECRET @"the-client-secret" @@ -167,10 +168,20 @@ finishedRefreshWithFetcher:(GTMHTTPFetcher *)fetcher } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; - + NSString * cellIdentifier = @"Cell"; + [tableView registerClass:[MCTTableViewCell class] forCellReuseIdentifier:cellIdentifier]; + + MCTTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath]; MCOIMAPMessage *message = self.messages[indexPath.row]; + cell.textLabel.text = message.header.subject; + cell.messageRenderingOperation = [self.imapSession plainTextBodyRenderingOperationWithMessage:message + folder:@"INBOX"]; + + [cell.messageRenderingOperation start:^(NSString * plainTextBodyString, NSError * error) { + cell.detailTextLabel.text = plainTextBodyString; + cell.messageRenderingOperation = nil; + }]; return cell; } |