1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- //
- // AAPLCatalogTableTableViewController.m
- // UICatalog
- //
- // Created by Ryan Olson on 7/17/14.
- #import "AAPLCatalogTableTableViewController.h"
- // FLEX should only be compiled and used in debug builds.
- #import <FLEX/FLEX.h>
- @implementation AAPLCatalogTableTableViewController
- - (void)viewDidLoad
- {
- [super viewDidLoad];
-
- #if DEBUG
- [self registerViewControllerBasedOption];
- self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"FLEX" style:UIBarButtonItemStylePlain target:self action:@selector(flexButtonTapped:)];
- #endif
- }
- - (void)flexButtonTapped:(id)sender
- {
- #if DEBUG
- // This call shows the FLEX toolbar if it's not already shown.
- [[FLEXManager sharedManager] showExplorer];
- #endif
- }
- - (void)registerViewControllerBasedOption
- {
- // create UIViewController subclass
- UIViewController *viewController = [UIViewController new];
- // fill it with some stuff
- UILabel *infoLabel = [UILabel new];
- infoLabel.translatesAutoresizingMaskIntoConstraints = NO;
- infoLabel.text = @"Add switches, notes or whatever you wish to provide your testers with superpowers!";
- infoLabel.numberOfLines = 0;
- infoLabel.textAlignment = NSTextAlignmentCenter;
- UIView *view = viewController.view;
- view.backgroundColor = UIColor.whiteColor;
- [view addSubview:infoLabel];
- [view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[infoLabel]-0-|"
- options:0
- metrics:nil
- views:NSDictionaryOfVariableBindings(infoLabel)]];
- [view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[infoLabel]-0-|"
- options:0
- metrics:nil
- views:NSDictionaryOfVariableBindings(infoLabel)]];
- // return it in viewControllerFutureBlock
- [[FLEXManager sharedManager] registerGlobalEntryWithName:@"🛃 Custom Superpowers"
- viewControllerFutureBlock:^id{
- return viewController;
- }];
- }
- @end
|