FLEXImageExplorerViewController.m 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // FLEXImageExplorerViewController.m
  3. // Flipboard
  4. //
  5. // Created by Ryan Olson on 6/12/14.
  6. // Copyright (c) 2014 Flipboard. All rights reserved.
  7. //
  8. #import "FLEXImageExplorerViewController.h"
  9. #import "FLEXImagePreviewViewController.h"
  10. typedef NS_ENUM(NSUInteger, FLEXImageExplorerRow) {
  11. FLEXImageExplorerRowImage
  12. };
  13. @interface FLEXImageExplorerViewController ()
  14. @property (nonatomic, readonly) UIImage *image;
  15. @end
  16. @implementation FLEXImageExplorerViewController
  17. - (UIImage *)image
  18. {
  19. return [self.object isKindOfClass:[UIImage class]] ? self.object : nil;
  20. }
  21. #pragma mark - Superclass Overrides
  22. - (NSString *)customSectionTitle
  23. {
  24. return @"Shortcuts";
  25. }
  26. - (NSArray *)customSectionRowCookies
  27. {
  28. return @[@(FLEXImageExplorerRowImage)];
  29. }
  30. - (NSString *)customSectionTitleForRowCookie:(id)rowCookie
  31. {
  32. NSString *title = nil;
  33. if ([rowCookie isEqual:@(FLEXImageExplorerRowImage)]) {
  34. title = @"Show Image";
  35. }
  36. return title;
  37. }
  38. - (NSString *)customSectionSubtitleForRowCookie:(id)rowCookie
  39. {
  40. return nil;
  41. }
  42. - (BOOL)customSectionCanDrillIntoRowWithCookie:(id)rowCookie
  43. {
  44. return YES;
  45. }
  46. - (UIViewController *)customSectionDrillInViewControllerForRowCookie:(id)rowCookie
  47. {
  48. UIViewController *drillInViewController = nil;
  49. if ([rowCookie isEqual:@(FLEXImageExplorerRowImage)]) {
  50. drillInViewController = [[FLEXImagePreviewViewController alloc] initWithImage:self.image];
  51. }
  52. return drillInViewController;
  53. }
  54. @end