/HCDebugTool

iOS DebugTool

Primary LanguageObjective-CMIT LicenseMIT

HCDebugTool

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

demo

工具特点

本工具的特点是易扩展,扩展一个类似红框圈住的Module(模块),只需要实现三个方法,可以参考代码里的 HCDebugToolVisionModule.m

  1. 创建个继承HCDebugToolCommonModule 的类,并注册module
[[HCDebugToolManager sharedManager] registerModule:[[self alloc] init]];
  1. 实现 -moduleTitle 方法并返回Module 标题
- (NSString *)moduleTitle {
    return @"视觉工具";
}
  1. 重载父类方法,定义绿框内item的UI
- (NSArray <NSDictionary *>*)optionDicts {
    return @[@{HCDebugCommonModuleOptionKeys.title: @"颜色检查颜色检查颜色检查",
               HCDebugCommonModuleOptionKeys.viewTag: @(HCDebugToolVisionOptionViewTag_ColorCheck)},
             @{HCDebugCommonModuleOptionKeys.title: @"对齐检查",
               HCDebugCommonModuleOptionKeys.viewTag: @(HCDebugToolVisionOptionViewTag_PointCheck),
               HCDebugCommonModuleOptionKeys.hasSwich: @(YES),
               HCDebugCommonModuleOptionKeys.isSwichOn: @(YES),
               }];
}
  1. 响应item的交互事件
- (void)optionDidSelected:(HCDebugToolCommonOptionItemViewModel *)option
                  atIndex:(NSInteger)index {
    switch (option.viewTag) {
        case HCDebugToolVisionOptionViewTag_PointCheck:
            NSLog(@"HCDebugToolVisionOptionViewTag_PointCheck");
            break;
        case HCDebugToolVisionOptionViewTag_ColorCheck:
            NSLog(@"HCDebugToolVisionOptionViewTag_ColorCheck");
            break;
    }
}

- (void)optionSwitchDidChage:(HCDebugToolCommonOptionItemViewModel *)option
                      status:(BOOL)isOn {
    switch (option.viewTag) {
        case HCDebugToolVisionOptionViewTag_PointCheck:
            NSLog(@"HCDebugToolVisionOptionViewTag_PointCheck switch");
            break;
        case HCDebugToolVisionOptionViewTag_ColorCheck:
            NSLog(@"HCDebugToolVisionOptionViewTag_ColorCheck switch");
            break;
    }
}

Requirements

Installation

HCDebugTool is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'HCDebugTool'

Author

honchwong404@gmail.com, honchwong404@gmail.com

License

HCDebugTool is available under the MIT license. See the LICENSE file for more info.