TCMDebugButtonsView 1.0

TCMDebugButtonsView 1.0

测试已测试
语言语言 Obj-CObjective C
许可协议 MIT
发布最新发布2014年12月

Jiayong Ou维护。



  • 作者
  • Dominik Wagner

TCMDebugButtonView - 向您的iOS应用轻松添加调试按钮

目的

  • 加快在开发过程中提供用户可触达按钮的流程
  • 如果不需要,则自动隐藏,以免干扰截图
  • 通过以低成本添加基本UI来提供吸引您向应用程序添加调试功能的激励

要求

  • iOS 5.x或更高版本
  • ARC

示例用法

要使用它,您只需将TCMDebugButtonsView.hTCMDebugButtonsView.m添加到您的项目中。

#import TCMDebugButtonsView.h添加到预编译头文件,或添加到您希望使用它的任何文件中。

使用-[UIView TCM_addDebugButtonWithTitle:(NSString *)aTitle block:(void (^)(void)aBlock)]

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

将命名按钮添加到视图中。

- (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];
    }];

外观

Example Debug Button View

版本

1.0

  • 初始发布

许可协议

创建者

@monkeydom twitter adn of TheCodingMonkeys