FLEXInstancesTableViewController.m 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // FLEXInstancesTableViewController.m
  3. // Flipboard
  4. //
  5. // Created by Ryan Olson on 5/28/14.
  6. // Copyright (c) 2014 Flipboard. All rights reserved.
  7. //
  8. #import "FLEXInstancesTableViewController.h"
  9. #import "FLEXObjectExplorerFactory.h"
  10. #import "FLEXObjectExplorerViewController.h"
  11. #import "FLEXRuntimeUtility.h"
  12. #import "FLEXUtility.h"
  13. @interface FLEXInstancesTableViewController ()
  14. @end
  15. @implementation FLEXInstancesTableViewController
  16. - (BOOL)prefersStatusBarHidden
  17. {
  18. return YES;
  19. }
  20. #pragma mark - Table View Data Source
  21. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
  22. {
  23. return 1;
  24. }
  25. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  26. {
  27. return [self.instances count];
  28. }
  29. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  30. {
  31. static NSString *CellIdentifier = @"Cell";
  32. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
  33. if (!cell) {
  34. cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
  35. cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
  36. UIFont *cellFont = [FLEXUtility defaultTableViewCellLabelFont];
  37. cell.textLabel.font = cellFont;
  38. cell.detailTextLabel.font = cellFont;
  39. cell.detailTextLabel.textColor = [UIColor grayColor];
  40. }
  41. id instance = [self.instances objectAtIndex:indexPath.row];
  42. cell.textLabel.text = [NSString stringWithFormat:@"%p", instance];
  43. cell.detailTextLabel.text = [FLEXRuntimeUtility descriptionForIvarOrPropertyValue:instance];
  44. return cell;
  45. }
  46. #pragma mark - Table View Delegate
  47. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  48. {
  49. id instance = [self.instances objectAtIndex:indexPath.row];
  50. FLEXObjectExplorerViewController *drillInViewController = [FLEXObjectExplorerFactory explorerViewControllerForObject:instance];
  51. [self.navigationController pushViewController:drillInViewController animated:YES];
  52. }
  53. @end