| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- //
- // FLEXArrayExplorerViewController.m
- // Flipboard
- //
- // Created by Ryan Olson on 5/15/14.
- // Copyright (c) 2014 Flipboard. All rights reserved.
- //
- #import "FLEXArrayExplorerViewController.h"
- #import "FLEXRuntimeUtility.h"
- #import "FLEXObjectExplorerFactory.h"
- @interface FLEXArrayExplorerViewController ()
- @property (nonatomic, readonly) NSArray *array;
- @end
- @implementation FLEXArrayExplorerViewController
- - (NSArray *)array
- {
- return [self.object isKindOfClass:[NSArray class]] ? self.object : nil;
- }
- #pragma mark - Superclass Overrides
- - (NSString *)customSectionTitle
- {
- return @"Array Indices";
- }
- - (NSArray *)customSectionRowCookies
- {
- // Use index numbers as the row cookies
- NSMutableArray *cookies = [NSMutableArray arrayWithCapacity:self.array.count];
- for (NSUInteger i = 0; i < self.array.count; i++) {
- [cookies addObject:@(i)];
- }
- return cookies;
- }
- - (NSString *)customSectionTitleForRowCookie:(id)rowCookie
- {
- return [rowCookie description];
- }
- - (NSString *)customSectionSubtitleForRowCookie:(id)rowCookie
- {
- return [FLEXRuntimeUtility descriptionForIvarOrPropertyValue:[self detailObjectForRowCookie:rowCookie]];
- }
- - (UIViewController *)customSectionDrillInViewControllerForRowCookie:(id)rowCookie
- {
- return [FLEXObjectExplorerFactory explorerViewControllerForObject:[self detailObjectForRowCookie:rowCookie]];
- }
- - (BOOL)shouldShowDescription
- {
- return NO;
- }
- #pragma mark - Helpers
- - (id)detailObjectForRowCookie:(id)rowCookie
- {
- NSUInteger index = [rowCookie unsignedIntegerValue];
- return self.array[index];
- }
- @end
|