Latest 1.0
Homepage https://github.com/monkeydom/TCMDebugButtonsView
License MIT The MIT License (MIT)

Copyright (c) 2013 TheCodingMonkeys

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Platforms ios , requires ARC
Authors

TCMDebugButtonView – easily add debug buttons to your iOS app

Purpose

  • speed up the process of providing a user reachable button for features during development
  • let it hide itself if it isn’t needed so it doesn’t interfere with screenshots
  • give incentive to add debug facilities to your apps by making adding a rudimentary UI to reach them cheap

Requirements

  • iOS 5.x or later
  • ARC

Example Usage

To use it you just add TCMDebugButtonsView.h and TCMDebugButtonsView.m to your project.

Add #import TCMDebugButtonsView.h" to either your precompiled header, or in every file you want to use it.

Use either -[UIView TCM_addDebugButtonWithTitle:(NSString *)aTitle block:(void (^)(void)aBlock)]

or -[UIView TCM_addDebugButtonWithTitle:(NSString *)aTitle target:(id)aTarget action:(SEL)anAction]

to add named buttons to a view.

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    // the first call to TCM_addDebugButton… creates the debug button view implicitly

    // example one: add debug button to change the background color using blocks
    // remember to only use weak references, to not cause implicit retains with blocks
    __weak __typeof__(self) self_weak = self;
    [self.view TCM_addDebugButtonWithTitle:@"Red Background"  block:^{
        self_weak.view.backgroundColor = [UIColor redColor];
    }];

    // example two: add debug button to change the background back to white using target/action
    [self.view TCM_addDebugButtonWithTitle:@"White Background" target:self action:@selector(whiteBackgroundAction)];

    // example three: add debug button do present a view controller
    [self.view TCM_addDebugButtonWithTitle:@"Present View Controller"  block:^{
        [self_weak presentViewController:[[EXPNestedViewController alloc] init] animated:YES completion:NULL];
    }];

}
    // want the debug view to be on the top
    [self.view TCM_addDebugButtonsViewOnEdge:CGRectMinYEdge];

    // add debug button to change dismiss
    // remember to only use weak references, to not cause implicit retains with blocks
    __weak __typeof__(self) self_weak = self;
    [self.view TCM_addDebugButtonWithTitle:@"Dismiss"  block:^{
        [self_weak dismissViewControllerAnimated:YES
                                      completion:NULL];
    }];

How it looks like

Example Debug Button View

Releases

1.0.1

  • fixed missing initialization for associated object key – thanks to jou for pointing that out
  • fixed mixed spaces/tabs whitespace

1.0

  • initial release

License

Created by

@monkeydom twitter adn
of TheCodingMonkeys

Latest podspec

{
    "name": "TCMDebugButtonsView",
    "version": "1.0",
    "summary": "Easily add debug buttons to your iOS app",
    "description": "                    * speed up the process of providing a user reachable button for features during developmentn                    * let it hide itself if it isn't needed so it doesn't interfere with screenshotsn                    * give incentive to add debug facilities to your apps by making adding a rudimentary UI to reach them cheapn",
    "homepage": "https://github.com/monkeydom/TCMDebugButtonsView",
    "license": {
        "type": "MIT",
        "text": "                      The MIT License (MIT)nn                      Copyright (c) 2013 TheCodingMonkeysnn                      Permission is hereby granted, free of charge, to any person obtaining a copyn                      of this software and associated documentation files (the "Software"), to dealn                      in the Software without restriction, including without limitation the rightsn                      to use, copy, modify, merge, publish, distribute, sublicense, and/or selln                      copies of the Software, and to permit persons to whom the Software isn                      furnished to do so, subject to the following conditions:nn                      The above copyright notice and this permission notice shall be included inn                      all copies or substantial portions of the Software.nn                      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORn                      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,n                      FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEn                      AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERn                      LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,n                      OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INn                      THE SOFTWARE.n"
    },
    "authors": {
        "Dominik Wagner": "[email protected]"
    },
    "platforms": {
        "ios": null
    },
    "source": {
        "git": "https://github.com/monkeydom/TCMDebugButtonsView.git",
        "tag": "1.0"
    },
    "source_files": "Sources/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This