From e4ebede1728c1267b7c6194aec1feb434660aa62 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Fri, 25 Oct 2019 13:47:08 +0800 Subject: [PATCH 01/45] Update LLDebugTool.podspec --- LLDebugTool.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LLDebugTool.podspec b/LLDebugTool.podspec index 8a3b4c00..16105926 100644 --- a/LLDebugTool.podspec +++ b/LLDebugTool.podspec @@ -12,7 +12,7 @@ Pod::Spec.new do |s| s.public_header_files = "LLDebugTool/LLDebug.h", "LLDebugTool/DebugTool/*.h" s.source_files = "LLDebugTool/**/*.{h,m}" s.resources = "LLDebugTool/**/*.{xib,storyboard,bundle}" - s.frameworks = "Foundation", "UIKit", "Photos", "SystemConfiguration", "CoreTelephony", "QuickLook" + s.frameworks = "Foundation", "UIKit", "Photos", "SystemConfiguration", "CoreTelephony", "QuickLook", "WebKit" s.dependency "FMDB", "~> 2.0" s.dependency "Masonry" From c0a6b8f1070cd141a3e36ad85f6a3797d2f4e605 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Fri, 25 Oct 2019 13:50:09 +0800 Subject: [PATCH 02/45] Update demo. --- LLDebugToolDemo/ViewController.m | 1 + 1 file changed, 1 insertion(+) diff --git a/LLDebugToolDemo/ViewController.m b/LLDebugToolDemo/ViewController.m index 58913b38..80deece4 100644 --- a/LLDebugToolDemo/ViewController.m +++ b/LLDebugToolDemo/ViewController.m @@ -279,6 +279,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell.textLabel.text = NSLocalizedString(@"test.widget.border", nil); } else if (indexPath.section == 11) { cell.textLabel.text = NSLocalizedString(@"test.html", nil); + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; } return cell; } From 147f142a3350f3b61b1e24c952c83892b379e9da Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Fri, 25 Oct 2019 15:56:05 +0800 Subject: [PATCH 03/45] Property changeable. --- .../UserInterface/LLCrashViewController.m | 3 +- .../Function/NSObject+LL_Hierarchy.h | 2 + .../Function/NSObject+LL_Hierarchy.m | 23 ++++++++ .../LLHierarchyDetailViewController.m | 8 +++ .../UserInterface/LLHierarchyViewController.m | 5 +- .../LLHtmlConfigViewController.m | 3 +- .../Log/UserInterface/LLLogViewController.m | 3 +- .../UserInterface/LLNetworkViewController.m | 3 +- .../UserInterface/LLSandboxViewController.m | 3 +- .../UserInterface/LLSettingViewController.m | 11 ++-- .../UIViewController+LL_Utils.h | 6 +++ .../UIViewController+LL_Utils.m | 52 +++++++++++++++++++ .../CommonUI/Base/LLBaseViewController.h | 10 ---- .../CommonUI/Base/LLBaseViewController.m | 37 ------------- .../View/TitleCell/LLTitleCellModel.m | 14 +++++ .../LLEditTableViewController.m | 3 +- LLDebugTool/Core/Others/Tool/LLTool.h | 5 ++ LLDebugTool/Core/Others/Tool/LLTool.m | 4 ++ .../xcschemes/LLDebugToolDemo.xcscheme | 22 ++++---- 19 files changed, 144 insertions(+), 73 deletions(-) diff --git a/LLDebugTool/Core/Component/Crash/UserInterface/LLCrashViewController.m b/LLDebugTool/Core/Component/Crash/UserInterface/LLCrashViewController.m index 0e99dd93..71656128 100644 --- a/LLDebugTool/Core/Component/Crash/UserInterface/LLCrashViewController.m +++ b/LLDebugTool/Core/Component/Crash/UserInterface/LLCrashViewController.m @@ -30,6 +30,7 @@ #import "LLCrashDetailViewController.h" #import "LLImageNameConfig.h" #import "LLToastUtils.h" +#import "UIViewController+LL_Utils.h" static NSString *const kCrashCellID = @"CrashCellID"; @@ -87,7 +88,7 @@ - (void)deleteFilesWithIndexPaths:(NSArray *)indexPaths { [weakSelf.searchDataArray removeObjectsInArray:models]; [weakSelf.tableView deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade]; } else { - [weakSelf showAlertControllerWithMessage:@"Remove crash model fail" handler:^(NSInteger action) { + [weakSelf LL_showAlertControllerWithMessage:@"Remove crash model fail" handler:^(NSInteger action) { if (action == 1) { [weakSelf loadData]; } diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.h b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.h index 7afe25bd..63d26c77 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.h +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.h @@ -25,6 +25,8 @@ #import #import "LLTitleCellCategoryModel.h" +FOUNDATION_EXPORT NSNotificationName _Nonnull const LLHierarchyChangeNotificationName; + NS_ASSUME_NONNULL_BEGIN @interface NSObject (LL_Hierarchy) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 1c064b7f..12e9d756 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -27,6 +27,10 @@ #import "UIColor+LL_Utils.h" #import "LLFormatterTool.h" #import "LLEnumDescription.h" +#import "LLTool.h" +#import "UIViewController+LL_Utils.h" + +NSNotificationName const LLHierarchyChangeNotificationName = @"LLHierarchyChangeNotificationName"; @implementation NSObject (LL_Hierarchy) @@ -118,6 +122,19 @@ - (NSString *)LL_hierarchyOffsetDescription:(UIOffset)offset { return [NSString stringWithFormat:@"h %@ v %@",[LLFormatterTool formatNumber:@(offset.horizontal)], [LLFormatterTool formatNumber:@(offset.vertical)]]; } +- (void)LL_showHierarchyChangeAlertWithText:(NSString *)text handler:(nullable void (^)(NSString * _Nullable))handler { + [[LLTool keyWindow].rootViewController.LL_currentShowingViewController LL_showTextFieldAlertControllerWithMessage:@"Change Property" text:text handler:^(NSString * _Nullable newText) { + if (handler) { + handler(newText); + } + [self LL_postHierarchyChangeNotification]; + }]; +} + +- (void)LL_postHierarchyChangeNotification { + [[NSNotificationCenter defaultCenter] postNotificationName:LLHierarchyChangeNotificationName object:self]; +} + @end @implementation UIView (LL_Hierarchy) @@ -304,6 +321,12 @@ @implementation UIButton (LL_Hierarchy) [settings addObject:model2]; LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Title" detailTitle:[self LL_hierarchyTextDescription:self.currentTitle]]; + __weak typeof(self) weakSelf = self; + model3.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.currentTitle handler:^(NSString * _Nullable newText) { + [weakSelf setTitle:newText forState:weakSelf.state]; + }]; + }; [settings addObject:model3]; LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:self.currentAttributedTitle == nil ? @"Plain Text" : @"Attributed Text"]; diff --git a/LLDebugTool/Core/Component/Hierarchy/UserInterface/LLHierarchyDetailViewController.m b/LLDebugTool/Core/Component/Hierarchy/UserInterface/LLHierarchyDetailViewController.m index 5edaceaa..c826e8ae 100644 --- a/LLDebugTool/Core/Component/Hierarchy/UserInterface/LLHierarchyDetailViewController.m +++ b/LLDebugTool/Core/Component/Hierarchy/UserInterface/LLHierarchyDetailViewController.m @@ -33,6 +33,7 @@ #import "LLDetailTitleCell.h" #import "UIImage+LL_Utils.h" #import "NSObject+LL_Hierarchy.h" +#import "UIViewController+LL_Utils.h" @interface LLHierarchyDetailViewController () @@ -65,6 +66,8 @@ - (void)viewDidLoad { self.tableView.tableHeaderView = headerView; [self loadData]; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveLLHierarchyChangeNotification:) name:LLHierarchyChangeNotificationName object:nil]; } #pragma mark - Over write @@ -84,6 +87,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N return cell; } +#pragma mark - NSNotifications +- (void)didReceiveLLHierarchyChangeNotification:(NSNotification *)notification { + [self loadData]; +} + #pragma mark - Primary - (void)loadData { [self.objectDatas removeAllObjects]; diff --git a/LLDebugTool/Core/Component/Hierarchy/UserInterface/LLHierarchyViewController.m b/LLDebugTool/Core/Component/Hierarchy/UserInterface/LLHierarchyViewController.m index 61a6fda1..e1d27513 100644 --- a/LLDebugTool/Core/Component/Hierarchy/UserInterface/LLHierarchyViewController.m +++ b/LLDebugTool/Core/Component/Hierarchy/UserInterface/LLHierarchyViewController.m @@ -35,6 +35,7 @@ #import "LLHierarchyDetailViewController.h" #import "LLNavigationController.h" #import "LLTool.h" +#import "UIViewController+LL_Utils.h" @interface LLHierarchyViewController () @@ -234,7 +235,7 @@ - (void)showParentSheet:(UIView *)selectView { [actions addObject:NSStringFromClass(view.class)]; } __weak typeof(self) weakSelf = self; - [self showActionSheetWithTitle:@"Parent Views" actions:actions currentAction:nil completion:^(NSInteger index) { + [self LL_showActionSheetWithTitle:@"Parent Views" actions:actions currentAction:nil completion:^(NSInteger index) { [weakSelf setNewSelectView:parentViews[index]]; }]; } @@ -246,7 +247,7 @@ - (void)showSubviewSheet:(UIView *)selectView { [actions addObject:NSStringFromClass(view.class)]; } __weak typeof(self) weakSelf = self; - [self showActionSheetWithTitle:@"Subviews" actions:actions currentAction:nil completion:^(NSInteger index) { + [self LL_showActionSheetWithTitle:@"Subviews" actions:actions currentAction:nil completion:^(NSInteger index) { [weakSelf setNewSelectView:subviews[index]]; }]; } diff --git a/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.m b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.m index 6af81d6f..5c2448fa 100644 --- a/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.m +++ b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.m @@ -19,6 +19,7 @@ #import "LLHtmlUIWebViewController.h" #import "LLHtmlWkWebViewController.h" #import "LLConfig.h" +#import "UIViewController+LL_Utils.h" #import @interface LLHtmlConfigViewController () @@ -128,7 +129,7 @@ - (void)showWebViewClassAlert { [actions addObject:NSStringFromClass([UIWebView class])]; #pragma clang diagnostic pop __weak typeof(self) weakSelf = self; - [self showActionSheetWithTitle:@"Web View Style" actions:actions currentAction:self.webViewClass completion:^(NSInteger index) { + [self LL_showActionSheetWithTitle:@"Web View Style" actions:actions currentAction:self.webViewClass completion:^(NSInteger index) { [weakSelf setNewWebViewClass:actions[index]]; }]; } diff --git a/LLDebugTool/Core/Component/Log/UserInterface/LLLogViewController.m b/LLDebugTool/Core/Component/Log/UserInterface/LLLogViewController.m index 1e4f50ec..54a8b300 100644 --- a/LLDebugTool/Core/Component/Log/UserInterface/LLLogViewController.m +++ b/LLDebugTool/Core/Component/Log/UserInterface/LLLogViewController.m @@ -34,6 +34,7 @@ #import "LLToastUtils.h" #import "UIView+LL_Utils.h" #import "LLConst.h" +#import "UIViewController+LL_Utils.h" static NSString *const kLogCellID = @"LLLogCell"; @@ -123,7 +124,7 @@ - (void)deleteFilesWithIndexPaths:(NSArray *)indexPaths { if (result) { [weakSelf updateAfterDelete:models indexPaths:indexPaths]; } else { - [weakSelf showAlertControllerWithMessage:@"Remove log model fail" handler:^(NSInteger action) { + [weakSelf LL_showAlertControllerWithMessage:@"Remove log model fail" handler:^(NSInteger action) { if (action == 1) { [weakSelf loadData]; } diff --git a/LLDebugTool/Core/Component/Network/UserInterface/LLNetworkViewController.m b/LLDebugTool/Core/Component/Network/UserInterface/LLNetworkViewController.m index e820699d..fd4e848b 100644 --- a/LLDebugTool/Core/Component/Network/UserInterface/LLNetworkViewController.m +++ b/LLDebugTool/Core/Component/Network/UserInterface/LLNetworkViewController.m @@ -36,6 +36,7 @@ #import "LLToastUtils.h" #import "UIView+LL_Utils.h" #import "LLConst.h" +#import "UIViewController+LL_Utils.h" static NSString *const kNetworkCellID = @"NetworkCellID"; @@ -120,7 +121,7 @@ - (void)deleteFilesWithIndexPaths:(NSArray *)indexPaths { [weakSelf.searchDataArray removeObjectsInArray:models]; [weakSelf.tableView deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationFade]; } else { - [weakSelf showAlertControllerWithMessage:@"Remove network model fail" handler:^(NSInteger action) { + [weakSelf LL_showAlertControllerWithMessage:@"Remove network model fail" handler:^(NSInteger action) { if (action == 1) { [weakSelf loadData]; } diff --git a/LLDebugTool/Core/Component/Sandbox/UserInterface/LLSandboxViewController.m b/LLDebugTool/Core/Component/Sandbox/UserInterface/LLSandboxViewController.m index 1c5d8441..c45409a5 100644 --- a/LLDebugTool/Core/Component/Sandbox/UserInterface/LLSandboxViewController.m +++ b/LLDebugTool/Core/Component/Sandbox/UserInterface/LLSandboxViewController.m @@ -29,6 +29,7 @@ #import "LLImageNameConfig.h" #import "LLUITableViewLongPressGestureRecognizerDelegate.h" #import "LLToastUtils.h" +#import "UIViewController+LL_Utils.h" static NSString *const kSandboxCellID = @"LLSandboxCell"; @@ -115,7 +116,7 @@ - (BOOL)deleteFile:(LLSandboxModel *)model { if ([[NSFileManager defaultManager] fileExistsAtPath:model.filePath]) { BOOL ret = [[NSFileManager defaultManager] removeItemAtPath:model.filePath error:&error]; if (!ret) { - [self showAlertControllerWithMessage:[NSString stringWithFormat:@"Delete file fail\nFilePath:%@\nError:%@",model.filePath,error.localizedDescription] handler:nil]; + [self LL_showAlertControllerWithMessage:[NSString stringWithFormat:@"Delete file fail\nFilePath:%@\nError:%@",model.filePath,error.localizedDescription] handler:nil]; } return ret; } diff --git a/LLDebugTool/Core/Component/Setting/UserInterface/LLSettingViewController.m b/LLDebugTool/Core/Component/Setting/UserInterface/LLSettingViewController.m index 87a64647..99ec0909 100644 --- a/LLDebugTool/Core/Component/Setting/UserInterface/LLSettingViewController.m +++ b/LLDebugTool/Core/Component/Setting/UserInterface/LLSettingViewController.m @@ -35,6 +35,7 @@ #import "LLImageNameConfig.h" #import "LLConst.h" #import "LLTitleSliderCell.h" +#import "UIViewController+LL_Utils.h" @interface LLSettingViewController () @@ -119,7 +120,7 @@ - (void)showDoubleClickAlert { } } __weak typeof(self) weakSelf = self; - [self showActionSheetWithTitle:@"Double Click Event" actions:actions currentAction:[LLConfigHelper doubleClickComponentDescription] completion:^(NSInteger index) { + [self LL_showActionSheetWithTitle:@"Double Click Event" actions:actions currentAction:[LLConfigHelper doubleClickComponentDescription] completion:^(NSInteger index) { [weakSelf setNewDoubleClick:index + LLDebugToolActionSetting]; }]; } @@ -162,7 +163,7 @@ - (void)showColorStyleAlert { } } __weak typeof(self) weakSelf = self; - [self showActionSheetWithTitle:@"Color Style" actions:actions currentAction:[LLConfigHelper colorStyleDescription] completion:^(NSInteger index) { + [self LL_showActionSheetWithTitle:@"Color Style" actions:actions currentAction:[LLConfigHelper colorStyleDescription] completion:^(NSInteger index) { [weakSelf setNewColorStyle:index]; }]; } @@ -203,7 +204,7 @@ - (void)showStatusBarStyleAlert { } } __weak typeof(self) weakSelf = self; - [self showActionSheetWithTitle:@"Status Bar Style" actions:actions currentAction:[LLConfigHelper statusBarStyleDescription] completion:^(NSInteger index) { + [self LL_showActionSheetWithTitle:@"Status Bar Style" actions:actions currentAction:[LLConfigHelper statusBarStyleDescription] completion:^(NSInteger index) { [weakSelf setNewStatusBarStyle:index]; }]; } @@ -248,7 +249,7 @@ - (void)showEntryWindowStyleAlert { } } __weak typeof(self) weakSelf = self; - [self showActionSheetWithTitle:@"Entry Window Style" actions:actions currentAction:[LLConfigHelper entryWindowStyleDescription] completion:^(NSInteger index) { + [self LL_showActionSheetWithTitle:@"Entry Window Style" actions:actions currentAction:[LLConfigHelper entryWindowStyleDescription] completion:^(NSInteger index) { [weakSelf setNewEntryWindowStyle:index]; }]; } @@ -295,7 +296,7 @@ - (void)showLogStyleAlert { } } __weak typeof(self) weakSelf = self; - [self showActionSheetWithTitle:@"Log Style" actions:actions currentAction:[LLConfigHelper logStyleDescription] completion:^(NSInteger index) { + [self LL_showActionSheetWithTitle:@"Log Style" actions:actions currentAction:[LLConfigHelper logStyleDescription] completion:^(NSInteger index) { [weakSelf setNewLogStyle:index]; }]; } diff --git a/LLDebugTool/Core/Others/Category/UIViewController/UIViewController+LL_Utils.h b/LLDebugTool/Core/Others/Category/UIViewController/UIViewController+LL_Utils.h index 81353fef..f709809e 100644 --- a/LLDebugTool/Core/Others/Category/UIViewController/UIViewController+LL_Utils.h +++ b/LLDebugTool/Core/Others/Category/UIViewController/UIViewController+LL_Utils.h @@ -31,6 +31,12 @@ NS_ASSUME_NONNULL_BEGIN - (UIButton *)LL_navigationButtonWithTitle:(NSString *_Nullable)title imageName:(NSString *_Nullable)imageName target:(id _Nullable)target action:(SEL _Nullable)action; +- (void)LL_showAlertControllerWithMessage:(NSString *)message handler:(nullable void (^)(NSInteger action))handler; + +- (void)LL_showActionSheetWithTitle:(NSString *)title actions:(NSArray *)actions currentAction:(nullable NSString *)currentAction completion:(nullable void (^)(NSInteger index))completion; + +- (void)LL_showTextFieldAlertControllerWithMessage:(NSString *)message text:(nullable NSString *)text handler:(nullable void (^)(NSString * _Nullable))handler; + @end NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Others/Category/UIViewController/UIViewController+LL_Utils.m b/LLDebugTool/Core/Others/Category/UIViewController/UIViewController+LL_Utils.m index e94701df..14dd7073 100644 --- a/LLDebugTool/Core/Others/Category/UIViewController/UIViewController+LL_Utils.m +++ b/LLDebugTool/Core/Others/Category/UIViewController/UIViewController+LL_Utils.m @@ -25,6 +25,7 @@ #import "LLFactory.h" #import "LLThemeManager.h" #import "UIImage+LL_Utils.h" +#import "LLImageNameConfig.h" @implementation UIViewController (LL_Utils) @@ -58,4 +59,55 @@ - (UIButton *)LL_navigationButtonWithTitle:(NSString *_Nullable)title imageName: return btn; } +- (void)LL_showAlertControllerWithMessage:(NSString *)message handler:(void (^)(NSInteger action))handler { + UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Note" message:message preferredStyle:UIAlertControllerStyleAlert]; + UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) { + if (handler) { + handler(0); + } + }]; + UIAlertAction *confirm = [UIAlertAction actionWithTitle:@"Confirm" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * action) { + if (handler) { + handler(1); + } + }]; + [alert addAction:cancel]; + [alert addAction:confirm]; + [self presentViewController:alert animated:YES completion:nil]; +} + +- (void)LL_showActionSheetWithTitle:(NSString *)title actions:(NSArray *)actions currentAction:(NSString *)currentAction completion:(void (^)(NSInteger index))completion { + UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:title preferredStyle:UIAlertControllerStyleActionSheet]; + for (NSInteger i = 0; i < actions.count; i++) { + NSString *actionTitle = actions[i]; + __block NSInteger index = i; + UIAlertAction *action = [UIAlertAction actionWithTitle:actionTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { + if (completion) { + completion(index); + } + }]; + if (currentAction && [actionTitle isEqualToString:currentAction]) { + action.enabled = NO; + [action setValue:[UIImage LL_imageNamed:kSelectImageName] forKey:@"image"]; + } + [alert addAction:action]; + } + [alert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]]; + [self presentViewController:alert animated:YES completion:nil]; +} + +- (void)LL_showTextFieldAlertControllerWithMessage:(NSString *)message text:(nullable NSString *)text handler:(nullable void (^)(NSString * _Nullable))handler { + UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:message preferredStyle:UIAlertControllerStyleAlert]; + [alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { + textField.text = text; + }]; + [alert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]]; + [alert addAction:[UIAlertAction actionWithTitle:@"Confirm" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) { + if (handler) { + handler(alert.textFields.firstObject.text); + } + }]]; + [self presentViewController:alert animated:YES completion:nil]; +} + @end diff --git a/LLDebugTool/Core/Others/CommonUI/Base/LLBaseViewController.h b/LLDebugTool/Core/Others/CommonUI/Base/LLBaseViewController.h index 4278aca5..01c189d1 100644 --- a/LLDebugTool/Core/Others/CommonUI/Base/LLBaseViewController.h +++ b/LLDebugTool/Core/Others/CommonUI/Base/LLBaseViewController.h @@ -33,16 +33,6 @@ NS_ASSUME_NONNULL_BEGIN /// Right navigation item's custom view. @property (nonatomic, strong, nullable) UIButton *rightNavigationButton; -/** - * Simple alert. - */ -- (void)showAlertControllerWithMessage:(NSString *_Nullable)message handler:(void (^_Nullable)(NSInteger action))handler; - -/** - Simple sheet. - */ -- (void)showActionSheetWithTitle:(NSString *)title actions:(NSArray *)actions currentAction:(NSString *_Nullable)currentAction completion:(void (^ _Nullable)(NSInteger index))completion; - /** * Left navigation item action. */ diff --git a/LLDebugTool/Core/Others/CommonUI/Base/LLBaseViewController.m b/LLDebugTool/Core/Others/CommonUI/Base/LLBaseViewController.m index 3824b96a..f7676d52 100644 --- a/LLDebugTool/Core/Others/CommonUI/Base/LLBaseViewController.m +++ b/LLDebugTool/Core/Others/CommonUI/Base/LLBaseViewController.m @@ -49,43 +49,6 @@ - (void)dealloc { } #pragma mark - Public -- (void)showAlertControllerWithMessage:(NSString *)message handler:(void (^)(NSInteger action))handler { - UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Note" message:message preferredStyle:UIAlertControllerStyleAlert]; - UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) { - if (handler) { - handler(0); - } - }]; - UIAlertAction *confirm = [UIAlertAction actionWithTitle:@"Confirm" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * action) { - if (handler) { - handler(1); - } - }]; - [alert addAction:cancel]; - [alert addAction:confirm]; - [self presentViewController:alert animated:YES completion:nil]; -} - -- (void)showActionSheetWithTitle:(NSString *)title actions:(NSArray *)actions currentAction:(NSString *)currentAction completion:(void (^)(NSInteger index))completion { - UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:title preferredStyle:UIAlertControllerStyleActionSheet]; - for (NSInteger i = 0; i < actions.count; i++) { - NSString *actionTitle = actions[i]; - __block NSInteger index = i; - UIAlertAction *action = [UIAlertAction actionWithTitle:actionTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - if (completion) { - completion(index); - } - }]; - if (currentAction && [actionTitle isEqualToString:currentAction]) { - action.enabled = NO; - [action setValue:[UIImage LL_imageNamed:kSelectImageName] forKey:@"image"]; - } - [alert addAction:action]; - } - [alert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]]; - [self presentViewController:alert animated:YES completion:nil]; -} - - (void)leftItemClick:(UIButton *)sender { } diff --git a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m index e46e34bc..c8eba804 100644 --- a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m +++ b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m @@ -72,4 +72,18 @@ - (instancetype)initWithTitle:(NSString *)title value:(CGFloat)value minValue:(C return self; } +- (void)setBlock:(LLSettingModelBlock)block { + if (_block != block) { + _block = [block copy]; + _cellClass = NSStringFromClass(block ? LLDetailTitleSelectorCell.class : LLDetailTitleCell.class); + } +} + +- (void)setChangePropertyBlock:(LLSettingModelChangePropertyBlock)changePropertyBlock { + if (_changePropertyBlock != changePropertyBlock) { + _changePropertyBlock = [changePropertyBlock copy]; + _cellClass = NSStringFromClass(changePropertyBlock ? LLDetailTitleSelectorCell.class : LLDetailTitleCell.class); + } +} + @end diff --git a/LLDebugTool/Core/Others/CommonUI/ViewController/EditTableViewController/LLEditTableViewController.m b/LLDebugTool/Core/Others/CommonUI/ViewController/EditTableViewController/LLEditTableViewController.m index 5e040677..807f5e51 100644 --- a/LLDebugTool/Core/Others/CommonUI/ViewController/EditTableViewController/LLEditTableViewController.m +++ b/LLDebugTool/Core/Others/CommonUI/ViewController/EditTableViewController/LLEditTableViewController.m @@ -30,6 +30,7 @@ #import "LLTableViewSelectableModel.h" #import "LLConst.h" #import "UIView+LL_Utils.h" +#import "UIViewController+LL_Utils.h" @interface LLEditTableViewController () @@ -206,7 +207,7 @@ - (void)deleteItemClick:(UIBarButtonItem *)sender { - (void)showDeleteAlertWithIndexPaths:(NSArray *)indexPaths { if (indexPaths.count) { - [self showAlertControllerWithMessage:[NSString stringWithFormat:@"Sure to delete these %ld items?", (long)indexPaths.count] handler:^(NSInteger action) { + [self LL_showAlertControllerWithMessage:[NSString stringWithFormat:@"Sure to delete these %ld items?", (long)indexPaths.count] handler:^(NSInteger action) { if (action == 1) { [self deleteFilesWithIndexPaths:indexPaths]; } diff --git a/LLDebugTool/Core/Others/Tool/LLTool.h b/LLDebugTool/Core/Others/Tool/LLTool.h index 2b0e4487..95187a0f 100644 --- a/LLDebugTool/Core/Others/Tool/LLTool.h +++ b/LLDebugTool/Core/Others/Tool/LLTool.h @@ -58,6 +58,11 @@ NS_ASSUME_NONNULL_BEGIN */ + (UIWindow *)topWindow; +/** + Key window. + */ ++ (UIWindow *)keyWindow; + /** Internal log. diff --git a/LLDebugTool/Core/Others/Tool/LLTool.m b/LLDebugTool/Core/Others/Tool/LLTool.m index fc0da04f..f0614797 100644 --- a/LLDebugTool/Core/Others/Tool/LLTool.m +++ b/LLDebugTool/Core/Others/Tool/LLTool.m @@ -87,6 +87,10 @@ + (UIWindow *)topWindow { return topWindow; } ++ (UIWindow *)keyWindow { + return [UIApplication sharedApplication].keyWindow; +} + + (void)log:(NSString *)string { dispatch_async(dispatch_get_main_queue(), ^{ if ([LLConfig shared].isShowDebugToolLog) { diff --git a/LLDebugToolDemo.xcodeproj/xcshareddata/xcschemes/LLDebugToolDemo.xcscheme b/LLDebugToolDemo.xcodeproj/xcshareddata/xcschemes/LLDebugToolDemo.xcscheme index c67ee501..707bddcc 100644 --- a/LLDebugToolDemo.xcodeproj/xcshareddata/xcschemes/LLDebugToolDemo.xcscheme +++ b/LLDebugToolDemo.xcodeproj/xcshareddata/xcschemes/LLDebugToolDemo.xcscheme @@ -27,6 +27,15 @@ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + + + @@ -49,17 +58,6 @@ - - - - - - - - Date: Fri, 25 Oct 2019 16:04:25 +0800 Subject: [PATCH 04/45] Refactory --- .../UserInterface/LLHtmlConfigViewController.m | 2 +- .../UserInterface/LLSettingViewController.m | 10 +++++----- .../CommonUI/View/TitleCell/LLTitleCellModel.h | 3 --- .../CommonUI/View/TitleCell/LLTitleCellModel.m | 17 ----------------- 4 files changed, 6 insertions(+), 26 deletions(-) diff --git a/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.m b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.m index 5c2448fa..6970a4cc 100644 --- a/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.m +++ b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.m @@ -113,7 +113,7 @@ - (void)loadData { } - (LLTitleCellModel *)getWebViewStyleModel { - LLTitleCellModel *model = [[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitleSelector:self.webViewClass]; + LLTitleCellModel *model = [[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:self.webViewClass]; __weak typeof(self) weakSelf = self; model.block = ^{ [weakSelf showWebViewClassAlert]; diff --git a/LLDebugTool/Core/Component/Setting/UserInterface/LLSettingViewController.m b/LLDebugTool/Core/Component/Setting/UserInterface/LLSettingViewController.m index 99ec0909..a456e52a 100644 --- a/LLDebugTool/Core/Component/Setting/UserInterface/LLSettingViewController.m +++ b/LLDebugTool/Core/Component/Setting/UserInterface/LLSettingViewController.m @@ -104,7 +104,7 @@ - (void)setUpUI { - (LLTitleCellModel *)getDoubleClickComponentModel { __weak typeof(self) weakSelf = self; - LLTitleCellModel *model = [[LLTitleCellModel alloc] initWithTitle:@"Double Click" detailTitleSelector:[LLConfigHelper doubleClickComponentDescription]]; + LLTitleCellModel *model = [[LLTitleCellModel alloc] initWithTitle:@"Double Click" detailTitle:[LLConfigHelper doubleClickComponentDescription]]; model.block = ^{ [weakSelf showDoubleClickAlert]; }; @@ -147,7 +147,7 @@ - (void)setNewShakeToHide:(BOOL)isShakeToHide { - (LLTitleCellModel *)getColorStyleModel { __weak typeof(self) weakSelf = self; - LLTitleCellModel *model = [[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitleSelector:[LLConfigHelper colorStyleDetailDescription]]; + LLTitleCellModel *model = [[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLConfigHelper colorStyleDetailDescription]]; model.block = ^{ [weakSelf showColorStyleAlert]; }; @@ -182,7 +182,7 @@ - (void)setNewColorStyle:(LLConfigColorStyle)style { } - (LLTitleCellModel *)getStatusBarStyleModel { - LLTitleCellModel *model = [[LLTitleCellModel alloc] initWithTitle:@"Status Bar" detailTitleSelector:[LLConfigHelper statusBarStyleDescription]]; + LLTitleCellModel *model = [[LLTitleCellModel alloc] initWithTitle:@"Status Bar" detailTitle:[LLConfigHelper statusBarStyleDescription]]; __weak typeof(self) weakSelf = self; model.block = ^{ [weakSelf showStatusBarStyleAlert]; @@ -228,7 +228,7 @@ - (void)setNewStatusBarStyle:(UIStatusBarStyle)style { - (LLTitleCellModel *)getEntryWindowStyleModel { __weak typeof(self) weakSelf = self; - LLTitleCellModel *model = [[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitleSelector:[LLConfigHelper entryWindowStyleDescription]]; + LLTitleCellModel *model = [[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLConfigHelper entryWindowStyleDescription]]; model.block = ^{ [weakSelf showEntryWindowStyleAlert]; }; @@ -279,7 +279,7 @@ - (void)setNewShrinkToEdgeWhenInactive:(BOOL)isShrinkToEdgeWhenInactive { } - (LLTitleCellModel *)getLogStyleModel { - LLTitleCellModel *model = [[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitleSelector:[LLConfigHelper logStyleDescription]]; + LLTitleCellModel *model = [[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLConfigHelper logStyleDescription]]; __weak typeof(self) weakSelf = self; model.block = ^{ [weakSelf showLogStyleAlert]; diff --git a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.h b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.h index 82ce518c..6c225194 100644 --- a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.h +++ b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.h @@ -63,9 +63,6 @@ typedef void(^LLSettingModelChangePropertyBlock)(__nullable id obj); // LLDetailTitleCell - (instancetype)initWithTitle:(NSString *_Nullable)title detailTitle:(NSString *_Nullable)detailTitle; -// LLDetailTitleSelectorCell -- (instancetype)initWithTitle:(NSString *_Nullable)title detailTitleSelector:(NSString *_Nullable)detailTitle; - // LLTitleSliderCell - (instancetype)initWithTitle:(NSString *_Nullable)title value:(CGFloat)value minValue:(CGFloat)minValue maxValue:(CGFloat)maxValue; diff --git a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m index c8eba804..43d16b46 100644 --- a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m +++ b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m @@ -50,16 +50,6 @@ - (instancetype)initWithTitle:(NSString *)title detailTitle:(NSString *)detailTi return self; } -- (instancetype)initWithTitle:(NSString *)title detailTitleSelector:(NSString *)detailTitle { - if (self = [super init]) { - _title = [title copy]; - _detailTitle = [detailTitle copy]; - _cellClass = NSStringFromClass(LLDetailTitleSelectorCell.class); - _separatorInsets = UIEdgeInsetsMake(0, kLLGeneralMargin, 0, 0); - } - return self; -} - - (instancetype)initWithTitle:(NSString *)title value:(CGFloat)value minValue:(CGFloat)minValue maxValue:(CGFloat)maxValue { if (self = [super init]) { _title = [title copy]; @@ -79,11 +69,4 @@ - (void)setBlock:(LLSettingModelBlock)block { } } -- (void)setChangePropertyBlock:(LLSettingModelChangePropertyBlock)changePropertyBlock { - if (_changePropertyBlock != changePropertyBlock) { - _changePropertyBlock = [changePropertyBlock copy]; - _cellClass = NSStringFromClass(changePropertyBlock ? LLDetailTitleSelectorCell.class : LLDetailTitleCell.class); - } -} - @end From 27337d2c870259751ed9f498b4e0fdad6a9bec24 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Fri, 25 Oct 2019 16:09:18 +0800 Subject: [PATCH 05/45] Update LLHtmlComponent.m --- LLDebugTool/Core/Component/Html/LLHtmlComponent.m | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/LLDebugTool/Core/Component/Html/LLHtmlComponent.m b/LLDebugTool/Core/Component/Html/LLHtmlComponent.m index 75299e93..3bfb07d2 100644 --- a/LLDebugTool/Core/Component/Html/LLHtmlComponent.m +++ b/LLDebugTool/Core/Component/Html/LLHtmlComponent.m @@ -22,11 +22,12 @@ #import "LLHtmlComponent.h" #import "LLWindowManager.h" #import "LLNavigationController.h" +#import "LLHtmlConfigViewController.h" @implementation LLHtmlComponent - (void)componentDidLoad:(NSDictionary *)data { - LLHtmlWindow *window = [LLWindowManager htmlWindow]; + if (data[kLLComponentWindowRootViewControllerKey]) { Class rootViewControllerClass = NSClassFromString(data[kLLComponentWindowRootViewControllerKey]); if (rootViewControllerClass != nil) { @@ -37,10 +38,20 @@ - (void)componentDidLoad:(NSDictionary *)data { [viewController setValue:value forKey:key]; } LLNavigationController *nav = [[LLNavigationController alloc] initWithRootViewController:viewController]; + LLHtmlWindow *window = [LLWindowManager htmlWindow]; window.rootViewController = nav; + [[LLWindowManager shared] showWindow:window animated:YES]; + return; } } - [[LLWindowManager shared] showWindow:window animated:YES]; + + LLBaseWindow *window = [[LLWindowManager shared] visiableWindow]; + if ([window isKindOfClass:[LLFunctionWindow class]]) { + LLNavigationController *nav = (LLNavigationController *)window.rootViewController; + [nav pushViewController:[[LLHtmlConfigViewController alloc] init] animated:YES]; + } else { + [[LLWindowManager shared] showWindow:[LLWindowManager htmlWindow] animated:YES]; + } } @end From dda1b046943cf9f996e1b50b76635d426f3acfe3 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Fri, 25 Oct 2019 17:05:25 +0800 Subject: [PATCH 06/45] Refactory. --- .../Function/NSObject+LL_Hierarchy.m | 204 ++++++++++-------- .../View/TitleCell/LLTitleCellModel.h | 4 + .../View/TitleCell/LLTitleCellModel.m | 11 + .../EnumDescription/LLEnumDescription.h | 2 + .../EnumDescription/LLEnumDescription.m | 11 + 5 files changed, 140 insertions(+), 92 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 12e9d756..21e31d47 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -50,10 +50,6 @@ @implementation NSObject (LL_Hierarchy) return @[[[LLTitleCellCategoryModel alloc] initWithTitle:@"Object" items:settings]]; } -- (LLTitleCellModel *)LL_normalInsetsCellModelWithTitle:(NSString *)title detailTitle:(NSString *)detailTitle { - return [self LL_cellModelWithTitle:title detailTitle:detailTitle insets:UIEdgeInsetsMake(0, kLLGeneralMargin, 0, 0)]; -} - - (LLTitleCellModel *)LL_noneInsetsCellModelWithTitle:(NSString *)title detailTitle:(NSString *)detailTitle { return [self LL_cellModelWithTitle:title detailTitle:detailTitle insets:UIEdgeInsetsMake(0, LL_SCREEN_WIDTH, 0, 0)]; } @@ -122,7 +118,7 @@ - (NSString *)LL_hierarchyOffsetDescription:(UIOffset)offset { return [NSString stringWithFormat:@"h %@ v %@",[LLFormatterTool formatNumber:@(offset.horizontal)], [LLFormatterTool formatNumber:@(offset.vertical)]]; } -- (void)LL_showHierarchyChangeAlertWithText:(NSString *)text handler:(nullable void (^)(NSString * _Nullable))handler { +- (void)LL_showHierarchyChangeAlertWithText:(NSString *)text handler:(nullable void (^)(NSString * _Nullable newText))handler { [[LLTool keyWindow].rootViewController.LL_currentShowingViewController LL_showTextFieldAlertControllerWithMessage:@"Change Property" text:text handler:^(NSString * _Nullable newText) { if (handler) { handler(newText); @@ -131,6 +127,15 @@ - (void)LL_showHierarchyChangeAlertWithText:(NSString *)text handler:(nullable v }]; } +- (void)LL_showActionSheetWithActions:(NSArray *)actions currentAction:(NSString *)currentAction completion:(void (^)(NSInteger index))completion { + [[LLTool keyWindow].rootViewController.LL_currentShowingViewController LL_showActionSheetWithTitle:@"Change Property" actions:actions currentAction:currentAction completion:^(NSInteger index) { + if (completion) { + completion(index); + } + [self LL_postHierarchyChangeNotification]; + }]; +} + - (void)LL_postHierarchyChangeNotification { [[NSNotificationCenter defaultCenter] postNotificationName:LLHierarchyChangeNotificationName object:self]; } @@ -140,24 +145,37 @@ - (void)LL_postHierarchyChangeNotification { @implementation UIView (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + + __weak typeof(self) weakSelf = self; + NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Layer" detailTitle:self.layer.description]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_normalInsetsCellModelWithTitle:@"Layer Class" detailTitle:NSStringFromClass(self.layer.class)]; + LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Layer Class" detailTitle:NSStringFromClass(self.layer.class)]; [settings addObject:model2]; LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Content Model" detailTitle:[LLEnumDescription viewContentModeDescription:self.contentMode]]; + model3.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription viewContentModeDescriptions] currentAction:[LLEnumDescription viewContentModeDescription:weakSelf.contentMode] completion:^(NSInteger index) { + weakSelf.contentMode = index; + }]; + }; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_normalInsetsCellModelWithTitle:@"Tag" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.tag]]; + LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:@"Tag" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.tag]]; + model4.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.tag] handler:^(NSString * _Nullable newText) { + weakSelf.tag = [newText integerValue]; + }]; + }; [settings addObject:model4]; LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Interaction" detailTitle:[NSString stringWithFormat:@"User Interaction Enabled %@",[self LL_hierarchyBoolDescription:self.isUserInteractionEnabled]]]; [settings addObject:model5]; - LLTitleCellModel *model6 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Multiple Touch %@", [self LL_hierarchyBoolDescription:self.isMultipleTouchEnabled]]]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Multiple Touch %@", [self LL_hierarchyBoolDescription:self.isMultipleTouchEnabled]]]; [settings addObject:model6]; LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Alpha" detailTitle:[LLFormatterTool formatNumber:@(self.alpha)]]; @@ -166,7 +184,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:@"Background" detailTitle:[self LL_hierarchyColorDescription:self.backgroundColor]]; [settings addObject:model8]; - LLTitleCellModel *model9 = [self LL_normalInsetsCellModelWithTitle:@"Tint" detailTitle:[self LL_hierarchyColorDescription:self.tintColor]]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Tint" detailTitle:[self LL_hierarchyColorDescription:self.tintColor]]; [settings addObject:model9]; LLTitleCellModel *model10 = [self LL_noneInsetsCellModelWithTitle:@"Drawing" detailTitle:[NSString stringWithFormat:@"Opaque %@",[self LL_hierarchyBoolDescription:self.isOpaque]]]; @@ -181,7 +199,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model13 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clip To Bounds %@",[self LL_hierarchyBoolDescription:self.clipsToBounds]]]; [settings addObject:model13]; - LLTitleCellModel *model14 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Autoresizes Subviews %@", [self LL_hierarchyBoolDescription:self.autoresizesSubviews]]]; + LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Autoresizes Subviews %@", [self LL_hierarchyBoolDescription:self.autoresizesSubviews]]]; [settings addObject:model14]; LLTitleCellModel *model15 = [self LL_noneInsetsCellModelWithTitle:@"Trait Collection" detailTitle:nil]; @@ -199,7 +217,7 @@ @implementation UIView (LL_Hierarchy) [settings addObject:model18]; if (@available(iOS 10.0, *)) { - LLTitleCellModel *model19 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[LLEnumDescription traitEnvironmentLayoutDirectionDescription:self.traitCollection.layoutDirection]]; + LLTitleCellModel *model19 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[LLEnumDescription traitEnvironmentLayoutDirectionDescription:self.traitCollection.layoutDirection]]; [settings addObject:model19]; } @@ -242,7 +260,7 @@ @implementation UILabel (LL_Hierarchy) LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Enabled %@",[self LL_hierarchyBoolDescription:self.isEnabled]]]; [settings addObject:model7]; - LLTitleCellModel *model8 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Highlighted %@", [self LL_hierarchyBoolDescription:self.isHighlighted]]]; + LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Highlighted %@", [self LL_hierarchyBoolDescription:self.isHighlighted]]]; [settings addObject:model8]; LLTitleCellModel *model9 = [self LL_noneInsetsCellModelWithTitle:@"Baseline" detailTitle:[NSString stringWithFormat:@"Align %@",[LLEnumDescription baselineAdjustmentDescription:self.baselineAdjustment]]]; @@ -251,7 +269,7 @@ @implementation UILabel (LL_Hierarchy) LLTitleCellModel *model10 = [self LL_noneInsetsCellModelWithTitle:@"Line Break" detailTitle:[LLEnumDescription lineBreakModeDescription:self.lineBreakMode]]; [settings addObject:model10]; - LLTitleCellModel *model11 = [self LL_normalInsetsCellModelWithTitle:@"Min Font Scale" detailTitle:[LLFormatterTool formatNumber:@(self.minimumScaleFactor)]]; + LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:@"Min Font Scale" detailTitle:[LLFormatterTool formatNumber:@(self.minimumScaleFactor)]]; [settings addObject:model11]; LLTitleCellModel *model12 = [self LL_noneInsetsCellModelWithTitle:@"Highlighted" detailTitle:[self LL_hierarchyColorDescription:self.highlightedTextColor]]; @@ -260,7 +278,7 @@ @implementation UILabel (LL_Hierarchy) LLTitleCellModel *model13 = [self LL_noneInsetsCellModelWithTitle:@"Shadow" detailTitle:[self LL_hierarchyColorDescription:self.shadowColor]]; [settings addObject:model13]; - LLTitleCellModel *model14 = [self LL_normalInsetsCellModelWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:self.shadowOffset]]; + LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:self.shadowOffset]]; [settings addObject:model14]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Label" items:settings]; @@ -284,7 +302,7 @@ @implementation UIControl (LL_Hierarchy) LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Alignment" detailTitle:[NSString stringWithFormat:@"%@ Horizonally", [LLEnumDescription controlContentHorizontalAlignmentDescription:self.contentHorizontalAlignment]]]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"%@ Vertically", [LLEnumDescription controlContentVerticalAlignmentDescription:self.contentVerticalAlignment]]]; + LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"%@ Vertically", [LLEnumDescription controlContentVerticalAlignmentDescription:self.contentVerticalAlignment]]]; [settings addObject:model2]; LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Content" detailTitle:self.isSelected ? @"Selected" : @"Not Selected"]; @@ -293,7 +311,7 @@ @implementation UIControl (LL_Hierarchy) LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:self.isEnabled ? @"Enabled" : @"Not Enabled"]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:self.isHighlighted ? @"Highlighted" : @"Not Highlighted"]; + LLTitleCellModel *model5 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:self.isHighlighted ? @"Highlighted" : @"Not Highlighted"]; [settings addObject:model5]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Control" items:settings]; @@ -312,16 +330,18 @@ @implementation UIControl (LL_Hierarchy) @implementation UIButton (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + + __weak typeof(self) weakSelf = self; + NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_normalInsetsCellModelWithTitle:@"Type" detailTitle:[LLEnumDescription buttonTypeDescription:self.buttonType]]; + LLTitleCellModel *model1 = [[LLTitleCellModel alloc] initWithTitle:@"Type" detailTitle:[LLEnumDescription buttonTypeDescription:self.buttonType]]; [settings addObject:model1]; LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"State" detailTitle:[LLEnumDescription controlStateDescription:self.state]]; [settings addObject:model2]; LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Title" detailTitle:[self LL_hierarchyTextDescription:self.currentTitle]]; - __weak typeof(self) weakSelf = self; model3.block = ^{ [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.currentTitle handler:^(NSString * _Nullable newText) { [weakSelf setTitle:newText forState:weakSelf.state]; @@ -335,17 +355,17 @@ @implementation UIButton (LL_Hierarchy) LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Text Color" detailTitle:[self LL_hierarchyColorDescription:self.currentTitleColor]]; [settings addObject:model5]; - LLTitleCellModel *model6 = [self LL_normalInsetsCellModelWithTitle:@"Shadow Color" detailTitle:[self LL_hierarchyColorDescription:self.currentTitleShadowColor]]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Shadow Color" detailTitle:[self LL_hierarchyColorDescription:self.currentTitleShadowColor]]; [settings addObject:model6]; id target = self.allTargets.allObjects.firstObject; LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Target" detailTitle:target ? [NSString stringWithFormat:@"%@",target] : @""]; [settings addObject:model7]; - LLTitleCellModel *model8 = [self LL_normalInsetsCellModelWithTitle:@"Action" detailTitle:[self LL_hierarchyTextDescription:[self actionsForTarget:target forControlEvent:UIControlEventTouchUpInside].firstObject]];; + LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:@"Action" detailTitle:[self LL_hierarchyTextDescription:[self actionsForTarget:target forControlEvent:UIControlEventTouchUpInside].firstObject]];; [settings addObject:model8]; - LLTitleCellModel *model9 = [self LL_normalInsetsCellModelWithTitle:@"Image" detailTitle:[self LL_hierarchyImageDescription:self.currentImage]]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Image" detailTitle:[self LL_hierarchyImageDescription:self.currentImage]]; [settings addObject:model9]; #pragma clang diagnostic push @@ -368,7 +388,7 @@ @implementation UIButton (LL_Hierarchy) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - LLTitleCellModel *model15 = [self LL_normalInsetsCellModelWithTitle:@"Line Break" detailTitle:[LLEnumDescription lineBreakModeDescription:self.lineBreakMode]]; + LLTitleCellModel *model15 = [[LLTitleCellModel alloc] initWithTitle:@"Line Break" detailTitle:[LLEnumDescription lineBreakModeDescription:self.lineBreakMode]]; [settings addObject:model15]; #pragma clang diagnostic pop @@ -387,7 +407,7 @@ @implementation UIButton (LL_Hierarchy) LLTitleCellModel *model20 = [self LL_noneInsetsCellModelWithTitle:@"Image Insets" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.imageEdgeInsets]]; [settings addObject:model20]; - LLTitleCellModel *model21 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.imageEdgeInsets]]; + LLTitleCellModel *model21 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.imageEdgeInsets]]; [settings addObject:model21]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Button" items:settings]; @@ -408,13 +428,13 @@ @implementation UIImageView (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_normalInsetsCellModelWithTitle:@"Image" detailTitle: [self LL_hierarchyImageDescription:self.image]]; + LLTitleCellModel *model1 = [[LLTitleCellModel alloc] initWithTitle:@"Image" detailTitle: [self LL_hierarchyImageDescription:self.image]]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_normalInsetsCellModelWithTitle:@"Highlighted" detailTitle: [self LL_hierarchyImageDescription:self.highlightedImage]]; + LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Highlighted" detailTitle: [self LL_hierarchyImageDescription:self.highlightedImage]]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_normalInsetsCellModelWithTitle:@"State" detailTitle:self.isHighlighted ? @"Highlighted" : @"Not Highlighted"]; + LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"State" detailTitle:self.isHighlighted ? @"Highlighted" : @"Not Highlighted"]; [settings addObject:model3]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Image View" items:settings]; @@ -453,28 +473,28 @@ @implementation UITextField (LL_Hierarchy) LLTitleCellModel *model6 = [self LL_noneInsetsCellModelWithTitle:@"Alignment" detailTitle:[LLEnumDescription textAlignmentDescription:self.textAlignment]]; [settings addObject:model6]; - LLTitleCellModel *model7 = [self LL_normalInsetsCellModelWithTitle:@"Placeholder" detailTitle:[self LL_hierarchyTextDescription:self.placeholder ?: self.attributedPlaceholder.string]]; + LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:@"Placeholder" detailTitle:[self LL_hierarchyTextDescription:self.placeholder ?: self.attributedPlaceholder.string]]; [settings addObject:model7]; LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:@"Background" detailTitle: [self LL_hierarchyImageDescription:self.background]]; [settings addObject:model8]; - LLTitleCellModel *model9 = [self LL_normalInsetsCellModelWithTitle:@"Disabled" detailTitle: [self LL_hierarchyImageDescription:self.disabledBackground]]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Disabled" detailTitle: [self LL_hierarchyImageDescription:self.disabledBackground]]; [settings addObject:model9]; - LLTitleCellModel *model10 = [self LL_normalInsetsCellModelWithTitle:@"Border Style" detailTitle:[LLEnumDescription textBorderStyleDescription:self.borderStyle]]; + LLTitleCellModel *model10 = [[LLTitleCellModel alloc] initWithTitle:@"Border Style" detailTitle:[LLEnumDescription textBorderStyleDescription:self.borderStyle]]; [settings addObject:model10]; LLTitleCellModel *model11 = [self LL_noneInsetsCellModelWithTitle:@"Clear Button" detailTitle:[LLEnumDescription textFieldViewModeDescription:self.clearButtonMode]]; [settings addObject:model11]; - LLTitleCellModel *model12 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clear when editing begins %@", [self LL_hierarchyBoolDescription:self.clearsOnBeginEditing]]]; + LLTitleCellModel *model12 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clear when editing begins %@", [self LL_hierarchyBoolDescription:self.clearsOnBeginEditing]]]; [settings addObject:model12]; LLTitleCellModel *model13 = [self LL_noneInsetsCellModelWithTitle:@"Min Font Size" detailTitle:[LLFormatterTool formatNumber:@(self.minimumFontSize)]]; [settings addObject:model13]; - LLTitleCellModel *model14 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Adjusts to Fit %@",[self LL_hierarchyBoolDescription:self.adjustsFontSizeToFitWidth]]]; + LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Adjusts to Fit %@",[self LL_hierarchyBoolDescription:self.adjustsFontSizeToFitWidth]]]; [settings addObject:model14]; LLTitleCellModel *model15 = [self LL_noneInsetsCellModelWithTitle:@"Capitalization" detailTitle:[LLEnumDescription textAutocapitalizationTypeDescription:self.autocapitalizationType]]; @@ -495,7 +515,7 @@ @implementation UITextField (LL_Hierarchy) LLTitleCellModel *model20 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Auto-enable Return Key %@", [self LL_hierarchyBoolDescription:self.enablesReturnKeyAutomatically]]]; [settings addObject:model20]; - LLTitleCellModel *model21 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Secure Entry %@",[self LL_hierarchyBoolDescription:self.secureTextEntry]]]; + LLTitleCellModel *model21 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Secure Entry %@",[self LL_hierarchyBoolDescription:self.secureTextEntry]]]; [settings addObject:model21]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Text Field" items:settings]; @@ -519,7 +539,7 @@ @implementation UISegmentedControl (LL_Hierarchy) LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Behavior" detailTitle:self.isMomentary ? @"Momentary" : @"Persistent Selection"]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_normalInsetsCellModelWithTitle:@"Segments" detailTitle:[NSString stringWithFormat:@"%ld",(unsigned long)self.numberOfSegments]]; + LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Segments" detailTitle:[NSString stringWithFormat:@"%ld",(unsigned long)self.numberOfSegments]]; [settings addObject:model2]; LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Selected Index" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.selectedSegmentIndex]]; @@ -535,7 +555,7 @@ @implementation UISegmentedControl (LL_Hierarchy) } #endif - LLTitleCellModel *model6 = [self LL_normalInsetsCellModelWithTitle:@"Selected" detailTitle:[self isEnabledForSegmentAtIndex:self.selectedSegmentIndex] ? @"Enabled" : @"Not Enabled"]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Selected" detailTitle:[self isEnabledForSegmentAtIndex:self.selectedSegmentIndex] ? @"Enabled" : @"Not Enabled"]; [settings addObject:model6]; LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Offset" detailTitle:[self LL_hierarchySizeDescription:[self contentOffsetForSegmentAtIndex:self.selectedSegmentIndex]]]; @@ -544,7 +564,7 @@ @implementation UISegmentedControl (LL_Hierarchy) LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:@"Size Mode" detailTitle:self.apportionsSegmentWidthsByContent ? @"Proportional to Content" : @"Equal Widths"]; [settings addObject:model8]; - LLTitleCellModel *model9 = [self LL_normalInsetsCellModelWithTitle:@"Width" detailTitle:[LLFormatterTool formatNumber:@([self widthForSegmentAtIndex:self.selectedSegmentIndex])]]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Width" detailTitle:[LLFormatterTool formatNumber:@([self widthForSegmentAtIndex:self.selectedSegmentIndex])]]; [settings addObject:model9]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Segmented Control" items:settings]; @@ -571,13 +591,13 @@ @implementation UISlider (LL_Hierarchy) LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Minimum" detailTitle:[LLFormatterTool formatNumber:@(self.minimumValue)]]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_normalInsetsCellModelWithTitle:@"Maximum" detailTitle:[LLFormatterTool formatNumber:@(self.maximumValue)]]; + LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Maximum" detailTitle:[LLFormatterTool formatNumber:@(self.maximumValue)]]; [settings addObject:model3]; LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:@"Min Image" detailTitle: [self LL_hierarchyImageDescription:self.minimumValueImage]]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_normalInsetsCellModelWithTitle:@"Max Image" detailTitle: [self LL_hierarchyImageDescription:self.maximumValueImage]]; + LLTitleCellModel *model5 = [[LLTitleCellModel alloc] initWithTitle:@"Max Image" detailTitle: [self LL_hierarchyImageDescription:self.maximumValueImage]]; [settings addObject:model5]; LLTitleCellModel *model6 = [self LL_noneInsetsCellModelWithTitle:@"Min Track Tint" detailTitle:[self LL_hierarchyColorDescription:self.minimumTrackTintColor]]; @@ -586,10 +606,10 @@ @implementation UISlider (LL_Hierarchy) LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Max Track Tint" detailTitle:[self LL_hierarchyColorDescription:self.maximumTrackTintColor]]; [settings addObject:model7]; - LLTitleCellModel *model8 = [self LL_normalInsetsCellModelWithTitle:@"Thumb Tint" detailTitle:[self LL_hierarchyColorDescription:self.tintColor]]; + LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:@"Thumb Tint" detailTitle:[self LL_hierarchyColorDescription:self.tintColor]]; [settings addObject:model8]; - LLTitleCellModel *model9 = [self LL_normalInsetsCellModelWithTitle:@"Events" detailTitle:[NSString stringWithFormat:@"Continuous Update %@", [self LL_hierarchyBoolDescription:self.continuous]]]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Events" detailTitle:[NSString stringWithFormat:@"Continuous Update %@", [self LL_hierarchyBoolDescription:self.continuous]]]; [settings addObject:model9]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Slider" items:settings]; @@ -616,7 +636,7 @@ @implementation UISwitch (LL_Hierarchy) LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"On Tint" detailTitle:[self LL_hierarchyColorDescription:self.onTintColor]]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_normalInsetsCellModelWithTitle:@"Thumb Tint" detailTitle:[self LL_hierarchyColorDescription:self.thumbTintColor]]; + LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Thumb Tint" detailTitle:[self LL_hierarchyColorDescription:self.thumbTintColor]]; [settings addObject:model3]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Switch" items:settings]; @@ -646,7 +666,7 @@ @implementation UIActivityIndicatorView (LL_Hierarchy) LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Animating %@", [self LL_hierarchyBoolDescription:self.isAnimating]]]; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Hides When Stopped %@", [self LL_hierarchyBoolDescription:self.hidesWhenStopped]]]; + LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Hides When Stopped %@", [self LL_hierarchyBoolDescription:self.hidesWhenStopped]]]; [settings addObject:model4]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Activity Indicator View" items:settings]; @@ -667,22 +687,22 @@ @implementation UIProgressView (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_normalInsetsCellModelWithTitle:@"Style" detailTitle:[LLEnumDescription progressViewStyleDescription:self.progressViewStyle]]; + LLTitleCellModel *model1 = [[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription progressViewStyleDescription:self.progressViewStyle]]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_normalInsetsCellModelWithTitle:@"Progress" detailTitle:[LLFormatterTool formatNumber:@(self.progress)]]; + LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Progress" detailTitle:[LLFormatterTool formatNumber:@(self.progress)]]; [settings addObject:model2]; LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Progress Tint" detailTitle:[self LL_hierarchyColorDescription:self.progressTintColor]]; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_normalInsetsCellModelWithTitle:@"Track Tint" detailTitle:[self LL_hierarchyColorDescription:self.trackTintColor]]; + LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:@"Track Tint" detailTitle:[self LL_hierarchyColorDescription:self.trackTintColor]]; [settings addObject:model4]; LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Progress Image" detailTitle:[self LL_hierarchyImageDescription:self.progressImage]]; [settings addObject:model5]; - LLTitleCellModel *model6 = [self LL_normalInsetsCellModelWithTitle:@"Track Image" detailTitle:[self LL_hierarchyImageDescription:self.trackImage]]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Track Image" detailTitle:[self LL_hierarchyImageDescription:self.trackImage]]; [settings addObject:model6]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Progress View" items:settings]; @@ -712,13 +732,13 @@ @implementation UIPageControl (LL_Hierarchy) LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Hides for Single Page %@",[self LL_hierarchyBoolDescription:self.hidesForSinglePage]]]; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Defers Page Display %@", [self LL_hierarchyBoolDescription:self.defersCurrentPageDisplay]]]; + LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Defers Page Display %@", [self LL_hierarchyBoolDescription:self.defersCurrentPageDisplay]]]; [settings addObject:model4]; LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Tint Color" detailTitle:[self LL_hierarchyColorDescription:self.pageIndicatorTintColor]]; [settings addObject:model5]; - LLTitleCellModel *model6 = [self LL_normalInsetsCellModelWithTitle:@"Current Page" detailTitle:[self LL_hierarchyColorDescription:self.currentPageIndicatorTintColor]]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Current Page" detailTitle:[self LL_hierarchyColorDescription:self.currentPageIndicatorTintColor]]; [settings addObject:model6]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Page Control" items:settings]; @@ -748,7 +768,7 @@ @implementation UIStepper (LL_Hierarchy) LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Maximum" detailTitle:[LLFormatterTool formatNumber:@(self.maximumValue)]]; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_normalInsetsCellModelWithTitle:@"Step" detailTitle:[LLFormatterTool formatNumber:@(self.stepValue)]]; + LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:@"Step" detailTitle:[LLFormatterTool formatNumber:@(self.stepValue)]]; [settings addObject:model4]; LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Autorepeat %@",[self LL_hierarchyBoolDescription:self.autorepeat]]]; @@ -757,7 +777,7 @@ @implementation UIStepper (LL_Hierarchy) LLTitleCellModel *model6 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Continuous %@",[self LL_hierarchyBoolDescription:self.continuous]]]; [settings addObject:model6]; - LLTitleCellModel *model7 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Wrap %@",[self LL_hierarchyBoolDescription:self.wraps]]]; + LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Wrap %@",[self LL_hierarchyBoolDescription:self.wraps]]]; [settings addObject:model7]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Stepper" items:settings]; @@ -778,13 +798,13 @@ @implementation UIScrollView (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_normalInsetsCellModelWithTitle:@"Style" detailTitle:[LLEnumDescription scrollViewIndicatorStyleDescription:self.indicatorStyle]]; + LLTitleCellModel *model1 = [[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription scrollViewIndicatorStyleDescription:self.indicatorStyle]]; [settings addObject:model1]; LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Indicators" detailTitle:[NSString stringWithFormat:@"Shows Horizontal Indicator %@",[self LL_hierarchyBoolDescription:self.showsHorizontalScrollIndicator]]]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Vertical Indicator %@",[self LL_hierarchyBoolDescription:self.showsVerticalScrollIndicator]]]; + LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Vertical Indicator %@",[self LL_hierarchyBoolDescription:self.showsVerticalScrollIndicator]]]; [settings addObject:model3]; LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:@"Scrolling" detailTitle:[NSString stringWithFormat:@"Scrolling %@", self.scrollEnabled ? @"Enabled" : @"Not Enabled"]]; @@ -793,7 +813,7 @@ @implementation UIScrollView (LL_Hierarchy) LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Paging %@", self.pagingEnabled ? @"Enabled" : @"Disabled"]]; [settings addObject:model5]; - LLTitleCellModel *model6 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Direction Lock %@",self.isDirectionalLockEnabled ? @"Enabled" : @"Disabled"]]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Direction Lock %@",self.isDirectionalLockEnabled ? @"Enabled" : @"Disabled"]]; [settings addObject:model6]; LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Bounce" detailTitle:[NSString stringWithFormat:@"Bounces %@",[self LL_hierarchyBoolDescription:self.bounces]]]; @@ -802,13 +822,13 @@ @implementation UIScrollView (LL_Hierarchy) LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Bounce Horizontal %@",[self LL_hierarchyBoolDescription:self.alwaysBounceHorizontal]]]; [settings addObject:model8]; - LLTitleCellModel *model9 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Bounce Vertical %@",[self LL_hierarchyBoolDescription:self.alwaysBounceVertical]]]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Bounce Vertical %@",[self LL_hierarchyBoolDescription:self.alwaysBounceVertical]]]; [settings addObject:model9]; LLTitleCellModel *model10 = [self LL_noneInsetsCellModelWithTitle:@"Zoom Min" detailTitle:[LLFormatterTool formatNumber:@(self.minimumZoomScale)]]; [settings addObject:model10]; - LLTitleCellModel *model11 = [self LL_normalInsetsCellModelWithTitle:@"Max" detailTitle:[LLFormatterTool formatNumber:@(self.maximumZoomScale)]]; + LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:@"Max" detailTitle:[LLFormatterTool formatNumber:@(self.maximumZoomScale)]]; [settings addObject:model11]; LLTitleCellModel *model12 = [self LL_noneInsetsCellModelWithTitle:@"Touch" detailTitle:[NSString stringWithFormat:@"Zoom Bounces %@",[self LL_hierarchyBoolDescription:self.isZoomBouncing]]]; @@ -817,10 +837,10 @@ @implementation UIScrollView (LL_Hierarchy) LLTitleCellModel *model13 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Delays Content Touches %@",[self LL_hierarchyBoolDescription:self.delaysContentTouches]]]; [settings addObject:model13]; - LLTitleCellModel *model14 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Cancellable Content Touches %@",[self LL_hierarchyBoolDescription:self.canCancelContentTouches]]]; + LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Cancellable Content Touches %@",[self LL_hierarchyBoolDescription:self.canCancelContentTouches]]]; [settings addObject:model14]; - LLTitleCellModel *model15 = [self LL_normalInsetsCellModelWithTitle:@"Keyboard" detailTitle:[LLEnumDescription scrollViewKeyboardDismissModeDescription:self.keyboardDismissMode]]; + LLTitleCellModel *model15 = [[LLTitleCellModel alloc] initWithTitle:@"Keyboard" detailTitle:[LLEnumDescription scrollViewKeyboardDismissModeDescription:self.keyboardDismissMode]]; [settings addObject:model15]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Scroll View" items:settings]; @@ -850,13 +870,13 @@ @implementation UITableView (LL_Hierarchy) LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Separator" detailTitle:[LLEnumDescription tableViewCellSeparatorStyleDescription:self.separatorStyle]]; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[self LL_hierarchyColorDescription:self.separatorColor]]; + LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyColorDescription:self.separatorColor]]; [settings addObject:model4]; LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Data Source" detailTitle:[self LL_hierarchyObjectDescription:self.dataSource]]; [settings addObject:model5]; - LLTitleCellModel *model6 = [self LL_normalInsetsCellModelWithTitle:@"Delegate" detailTitle:[self LL_hierarchyObjectDescription:self.delegate]]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Delegate" detailTitle:[self LL_hierarchyObjectDescription:self.delegate]]; [settings addObject:model6]; LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Separator Inset" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.separatorInset]]; @@ -866,7 +886,7 @@ @implementation UITableView (LL_Hierarchy) [settings addObject:model8]; if (@available(iOS 11.0, *)) { - LLTitleCellModel *model9 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[LLEnumDescription tableViewSeparatorInsetReferenceDescription:self.separatorInsetReference]]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[LLEnumDescription tableViewSeparatorInsetReferenceDescription:self.separatorInsetReference]]; [settings addObject:model9]; } @@ -879,7 +899,7 @@ @implementation UITableView (LL_Hierarchy) LLTitleCellModel *model12 = [self LL_noneInsetsCellModelWithTitle:@"Edit Selection" detailTitle:self.allowsSelectionDuringEditing ? @"Allowed" : @"Disabled"]; [settings addObject:model12]; - LLTitleCellModel *model13 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Multiple Selection %@",self.allowsMultipleSelection ? @"" : @"Disabled"]]; + LLTitleCellModel *model13 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Multiple Selection %@",self.allowsMultipleSelection ? @"" : @"Disabled"]]; [settings addObject:model13]; LLTitleCellModel *model14 = [self LL_noneInsetsCellModelWithTitle:@"Min Display" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.sectionIndexMinimumDisplayRowCount]]; @@ -891,7 +911,7 @@ @implementation UITableView (LL_Hierarchy) LLTitleCellModel *model16 = [self LL_noneInsetsCellModelWithTitle:@"Background" detailTitle:[self LL_hierarchyColorDescription:self.sectionIndexBackgroundColor]]; [settings addObject:model16]; - LLTitleCellModel *model17 = [self LL_normalInsetsCellModelWithTitle:@"Tracking" detailTitle:[self LL_hierarchyColorDescription:self.sectionIndexTrackingBackgroundColor]]; + LLTitleCellModel *model17 = [[LLTitleCellModel alloc] initWithTitle:@"Tracking" detailTitle:[self LL_hierarchyColorDescription:self.sectionIndexTrackingBackgroundColor]]; [settings addObject:model17]; LLTitleCellModel *model18 = [self LL_noneInsetsCellModelWithTitle:@"Row Height" detailTitle:[LLFormatterTool formatNumber:@(self.rowHeight)]]; @@ -900,7 +920,7 @@ @implementation UITableView (LL_Hierarchy) LLTitleCellModel *model19 = [self LL_noneInsetsCellModelWithTitle:@"Section Header" detailTitle:[LLFormatterTool formatNumber:@(self.sectionHeaderHeight)]]; [settings addObject:model19]; - LLTitleCellModel *model20 = [self LL_normalInsetsCellModelWithTitle:@"Section Footer" detailTitle:[LLFormatterTool formatNumber:@(self.sectionFooterHeight)]]; + LLTitleCellModel *model20 = [[LLTitleCellModel alloc] initWithTitle:@"Section Footer" detailTitle:[LLFormatterTool formatNumber:@(self.sectionFooterHeight)]]; [settings addObject:model20]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Table View" items:settings]; @@ -922,10 +942,10 @@ @implementation UITableViewCell (LL_Hierarchy) NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_normalInsetsCellModelWithTitle:@"Image" detailTitle:[self LL_hierarchyImageDescription:self.imageView.image]]; + LLTitleCellModel *model1 = [[LLTitleCellModel alloc] initWithTitle:@"Image" detailTitle:[self LL_hierarchyImageDescription:self.imageView.image]]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_normalInsetsCellModelWithTitle:@"Identifier" detailTitle:[self LL_hierarchyTextDescription:self.reuseIdentifier]]; + LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Identifier" detailTitle:[self LL_hierarchyTextDescription:self.reuseIdentifier]]; [settings addObject:model2]; LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Selection" detailTitle:[LLEnumDescription tableViewCellSelectionStyleDescription:self.selectionStyle]]; @@ -934,7 +954,7 @@ @implementation UITableViewCell (LL_Hierarchy) LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:@"Accessory" detailTitle:[LLEnumDescription tableViewCellAccessoryTypeDescription:self.accessoryType]]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_normalInsetsCellModelWithTitle:@"Editing Acc." detailTitle:[LLEnumDescription tableViewCellAccessoryTypeDescription:self.editingAccessoryType]]; + LLTitleCellModel *model5 = [[LLTitleCellModel alloc] initWithTitle:@"Editing Acc." detailTitle:[LLEnumDescription tableViewCellAccessoryTypeDescription:self.editingAccessoryType]]; [settings addObject:model5]; LLTitleCellModel *model6 = [self LL_noneInsetsCellModelWithTitle:@"Indentation" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.indentationLevel]]; @@ -946,13 +966,13 @@ @implementation UITableViewCell (LL_Hierarchy) LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Indent While Editing %@",[self LL_hierarchyBoolDescription:self.shouldIndentWhileEditing]]]; [settings addObject:model8]; - LLTitleCellModel *model9 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Re-order Controls %@",[self LL_hierarchyBoolDescription:self.showsReorderControl]]]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Re-order Controls %@",[self LL_hierarchyBoolDescription:self.showsReorderControl]]]; [settings addObject:model9]; LLTitleCellModel *model10 = [self LL_noneInsetsCellModelWithTitle:@"Separator Inset" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.separatorInset]]; [settings addObject:model10]; - LLTitleCellModel *model11 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.separatorInset]]; + LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.separatorInset]]; [settings addObject:model11]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Table View Cell" items:settings]; @@ -973,7 +993,7 @@ @implementation UICollectionView (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_normalInsetsCellModelWithTitle:@"Sections" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.numberOfSections]]; + LLTitleCellModel *model1 = [[LLTitleCellModel alloc] initWithTitle:@"Sections" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.numberOfSections]]; [settings addObject:model1]; LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Delegate" detailTitle:[self LL_hierarchyObjectDescription:self.delegate]]; @@ -982,7 +1002,7 @@ @implementation UICollectionView (LL_Hierarchy) LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Data Source" detailTitle:[self LL_hierarchyObjectDescription:self.dataSource]]; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_normalInsetsCellModelWithTitle:@"Layout" detailTitle:[self LL_hierarchyObjectDescription:self.collectionViewLayout]]; + LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:@"Layout" detailTitle:[self LL_hierarchyObjectDescription:self.collectionViewLayout]]; [settings addObject:model4]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Collection View" items:settings]; @@ -1039,13 +1059,13 @@ @implementation UITextView (LL_Hierarchy) LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Font" detailTitle:[self LL_hierarchyObjectDescription:self.font]]; [settings addObject:model5]; - LLTitleCellModel *model6 = [self LL_normalInsetsCellModelWithTitle:@"Alignment" detailTitle:[LLEnumDescription textAlignmentDescription:self.textAlignment]]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Alignment" detailTitle:[LLEnumDescription textAlignmentDescription:self.textAlignment]]; [settings addObject:model6]; LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Editable %@",[self LL_hierarchyBoolDescription:self.isEditable]]]; [settings addObject:model7]; - LLTitleCellModel *model8 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Selectable %@",[self LL_hierarchyBoolDescription:self.isSelectable]]]; + LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Selectable %@",[self LL_hierarchyBoolDescription:self.isSelectable]]]; [settings addObject:model8]; LLTitleCellModel *model9 = [self LL_noneInsetsCellModelWithTitle:@"Data Detectors" detailTitle:[NSString stringWithFormat:@"Phone Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypePhoneNumber]]]; @@ -1067,7 +1087,7 @@ @implementation UITextView (LL_Hierarchy) LLTitleCellModel *model14 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Flight Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeFlightNumber]]]; [settings addObject:model14]; - LLTitleCellModel *model15 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Lookup Suggestion %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeLookupSuggestion]]]; + LLTitleCellModel *model15 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Lookup Suggestion %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeLookupSuggestion]]]; [settings addObject:model15]; } else { model12.separatorInsets = UIEdgeInsetsMake(0, kLLGeneralMargin, 0, 0); @@ -1091,7 +1111,7 @@ @implementation UITextView (LL_Hierarchy) LLTitleCellModel *model21 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Auto-enable Return Key %@",[self LL_hierarchyBoolDescription:self.enablesReturnKeyAutomatically]]]; [settings addObject:model21]; - LLTitleCellModel *model22 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Secure Entry %@",[self LL_hierarchyBoolDescription:self.isSecureTextEntry]]]; + LLTitleCellModel *model22 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Secure Entry %@",[self LL_hierarchyBoolDescription:self.isSecureTextEntry]]]; [settings addObject:model22]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Text View" items:settings]; @@ -1118,7 +1138,7 @@ @implementation UIDatePicker (LL_Hierarchy) LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Locale Identifier" detailTitle:self.locale.localeIdentifier]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_normalInsetsCellModelWithTitle:@"Interval" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.minuteInterval]]; + LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Interval" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.minuteInterval]]; [settings addObject:model3]; LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:@"Date" detailTitle:[self LL_hierarchyObjectDescription:self.date]]; @@ -1127,13 +1147,13 @@ @implementation UIDatePicker (LL_Hierarchy) LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Min Date" detailTitle:[self LL_hierarchyObjectDescription:self.minimumDate]]; [settings addObject:model5]; - LLTitleCellModel *model6 = [self LL_normalInsetsCellModelWithTitle:@"Max Date" detailTitle:[self LL_hierarchyObjectDescription:self.maximumDate]]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Max Date" detailTitle:[self LL_hierarchyObjectDescription:self.maximumDate]]; [settings addObject:model6]; LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Count Down" detailTitle:[LLFormatterTool formatNumber:@(self.countDownDuration)]]; [settings addObject:model7]; - LLTitleCellModel *model8 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:@"Count Down in Seconds"]; + LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Count Down in Seconds"]; [settings addObject:model8]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Date Picker" items:settings]; @@ -1154,7 +1174,7 @@ @implementation UIPickerView (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_normalInsetsCellModelWithTitle:@"Delegate" detailTitle:[self LL_hierarchyObjectDescription:self.delegate]]; + LLTitleCellModel *model1 = [[LLTitleCellModel alloc] initWithTitle:@"Delegate" detailTitle:[self LL_hierarchyObjectDescription:self.delegate]]; [settings addObject:model1]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Picker View" items:settings]; @@ -1195,7 +1215,7 @@ @implementation UINavigationBar (LL_Hierarchy) LLTitleCellModel *model6 = [self LL_noneInsetsCellModelWithTitle:@"Back Image" detailTitle:[self LL_hierarchyImageDescription:self.backIndicatorImage]]; [settings addObject:model6]; - LLTitleCellModel *model7 = [self LL_normalInsetsCellModelWithTitle:@"Back Mask" detailTitle:[self LL_hierarchyImageDescription:self.backIndicatorTransitionMaskImage]]; + LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:@"Back Mask" detailTitle:[self LL_hierarchyImageDescription:self.backIndicatorTransitionMaskImage]]; [settings addObject:model7]; LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:@"Title Attr." detailTitle:nil]; @@ -1215,7 +1235,7 @@ @implementation UINavigationBar (LL_Hierarchy) LLTitleCellModel *model11 = [self LL_noneInsetsCellModelWithTitle:@"Shadow" detailTitle:[self LL_hierarchyColorDescription:shadow.shadowColor]]; [settings addObject:model11]; - LLTitleCellModel *model12 = [self LL_normalInsetsCellModelWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:shadow.shadowOffset]]; + LLTitleCellModel *model12 = [[LLTitleCellModel alloc] initWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:shadow.shadowOffset]]; [settings addObject:model12]; if (@available(iOS 11.0, *)) { @@ -1236,7 +1256,7 @@ @implementation UINavigationBar (LL_Hierarchy) LLTitleCellModel *model16 = [self LL_noneInsetsCellModelWithTitle:@"Shadow" detailTitle:[self LL_hierarchyColorDescription:shadow.shadowColor]]; [settings addObject:model16]; - LLTitleCellModel *model17 = [self LL_normalInsetsCellModelWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:shadow.shadowOffset]]; + LLTitleCellModel *model17 = [[LLTitleCellModel alloc] initWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:shadow.shadowOffset]]; [settings addObject:model17]; } @@ -1264,7 +1284,7 @@ @implementation UIToolbar (LL_Hierarchy) LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]]]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_normalInsetsCellModelWithTitle:@"Bar Tint" detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; + LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Bar Tint" detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; [settings addObject:model3]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Tool Bar" items:settings]; @@ -1291,7 +1311,7 @@ @implementation UITabBar (LL_Hierarchy) LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Shadow" detailTitle:[self LL_hierarchyImageDescription:self.shadowImage]]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_normalInsetsCellModelWithTitle:@"Selection" detailTitle:[self LL_hierarchyImageDescription:self.selectionIndicatorImage]]; + LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Selection" detailTitle:[self LL_hierarchyImageDescription:self.selectionIndicatorImage]]; [settings addObject:model3]; LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:@"Style" detailTitle:[LLEnumDescription barStyleDescription:self.barStyle]]; @@ -1300,7 +1320,7 @@ @implementation UITabBar (LL_Hierarchy) LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]]]; [settings addObject:model5]; - LLTitleCellModel *model6 = [self LL_normalInsetsCellModelWithTitle:@"Bar Tint" detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Bar Tint" detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; [settings addObject:model6]; LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Style" detailTitle:[LLEnumDescription tabBarItemPositioningDescription:self.itemPositioning]]; @@ -1309,7 +1329,7 @@ @implementation UITabBar (LL_Hierarchy) LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:@"Item Width" detailTitle:[LLFormatterTool formatNumber:@(self.itemWidth)]]; [settings addObject:model8]; - LLTitleCellModel *model9 = [self LL_normalInsetsCellModelWithTitle:@"Item Spacing" detailTitle:[LLFormatterTool formatNumber:@(self.itemSpacing)]]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Item Spacing" detailTitle:[LLFormatterTool formatNumber:@(self.itemSpacing)]]; [settings addObject:model9]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Tab Bar" items:settings]; @@ -1336,7 +1356,7 @@ @implementation UISearchBar (LL_Hierarchy) LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Placeholder" detailTitle:[self LL_hierarchyTextDescription:self.placeholder]]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_normalInsetsCellModelWithTitle:@"Prompt" detailTitle:[self LL_hierarchyTextDescription:self.prompt]]; + LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Prompt" detailTitle:[self LL_hierarchyTextDescription:self.prompt]]; [settings addObject:model3]; LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:@"Search Style" detailTitle:[LLEnumDescription searchBarStyleDescription:self.searchBarStyle]]; @@ -1348,19 +1368,19 @@ @implementation UISearchBar (LL_Hierarchy) LLTitleCellModel *model6 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]]]; [settings addObject:model6]; - LLTitleCellModel *model7 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; + LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; [settings addObject:model7]; LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:@"Background" detailTitle:[self LL_hierarchyImageDescription:self.backgroundImage]]; [settings addObject:model8]; - LLTitleCellModel *model9 = [self LL_normalInsetsCellModelWithTitle:@"Scope Bar" detailTitle:[self LL_hierarchyImageDescription:self.scopeBarBackgroundImage]]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Scope Bar" detailTitle:[self LL_hierarchyImageDescription:self.scopeBarBackgroundImage]]; [settings addObject:model9]; LLTitleCellModel *model10 = [self LL_noneInsetsCellModelWithTitle:@"Text Offset" detailTitle:[self LL_hierarchyOffsetDescription:self.searchTextPositionAdjustment]]; [settings addObject:model10]; - LLTitleCellModel *model11 = [self LL_normalInsetsCellModelWithTitle:@"BG Offset" detailTitle:[self LL_hierarchyOffsetDescription:self.searchFieldBackgroundPositionAdjustment]]; + LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:@"BG Offset" detailTitle:[self LL_hierarchyOffsetDescription:self.searchFieldBackgroundPositionAdjustment]]; [settings addObject:model11]; LLTitleCellModel *model12 = [self LL_noneInsetsCellModelWithTitle:@"Options" detailTitle:[NSString stringWithFormat:@"Shows Search Results Button %@",[self LL_hierarchyBoolDescription:self.showsSearchResultsButton]]]; @@ -1372,10 +1392,10 @@ @implementation UISearchBar (LL_Hierarchy) LLTitleCellModel *model14 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Cancel Button %@",[self LL_hierarchyBoolDescription:self.showsCancelButton]]]; [settings addObject:model14]; - LLTitleCellModel *model15 = [self LL_normalInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Scope Bar %@",[self LL_hierarchyBoolDescription:self.showsScopeBar]]]; + LLTitleCellModel *model15 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Scope Bar %@",[self LL_hierarchyBoolDescription:self.showsScopeBar]]]; [settings addObject:model15]; - LLTitleCellModel *model16 = [self LL_normalInsetsCellModelWithTitle:@"Scope Titles" detailTitle:[self LL_hierarchyObjectDescription:self.scopeButtonTitles]]; + LLTitleCellModel *model16 = [[LLTitleCellModel alloc] initWithTitle:@"Scope Titles" detailTitle:[self LL_hierarchyObjectDescription:self.scopeButtonTitles]]; [settings addObject:model16]; LLTitleCellModel *model17 = [self LL_noneInsetsCellModelWithTitle:@"Capitalization" detailTitle:[LLEnumDescription textAutocapitalizationTypeDescription:self.autocapitalizationType]]; @@ -1384,7 +1404,7 @@ @implementation UISearchBar (LL_Hierarchy) LLTitleCellModel *model18 = [self LL_noneInsetsCellModelWithTitle:@"Correction" detailTitle:[LLEnumDescription textAutocorrectionTypeDescription:self.autocorrectionType]]; [settings addObject:model18]; - LLTitleCellModel *model19 = [self LL_normalInsetsCellModelWithTitle:@"Keyboard" detailTitle:[LLEnumDescription keyboardTypeDescription:self.keyboardType]]; + LLTitleCellModel *model19 = [[LLTitleCellModel alloc] initWithTitle:@"Keyboard" detailTitle:[LLEnumDescription keyboardTypeDescription:self.keyboardType]]; [settings addObject:model19]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Search Bar" items:settings]; @@ -1408,7 +1428,7 @@ @implementation UIWindow (LL_Hierarchy) LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Key Window %@",[self LL_hierarchyBoolDescription:self.isKeyWindow]]]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_normalInsetsCellModelWithTitle:@"Root Controller" detailTitle:[self LL_hierarchyObjectDescription:self.rootViewController]]; + LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Root Controller" detailTitle:[self LL_hierarchyObjectDescription:self.rootViewController]]; [settings addObject:model2]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Window" items:settings]; diff --git a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.h b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.h index 6c225194..fa43fb5c 100644 --- a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.h +++ b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.h @@ -66,6 +66,10 @@ typedef void(^LLSettingModelChangePropertyBlock)(__nullable id obj); // LLTitleSliderCell - (instancetype)initWithTitle:(NSString *_Nullable)title value:(CGFloat)value minValue:(CGFloat)minValue maxValue:(CGFloat)maxValue; +- (LLTitleCellModel *)normalInsets; + +- (LLTitleCellModel *)noneInsets; + @end NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m index 43d16b46..728f24b3 100644 --- a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m +++ b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m @@ -27,6 +27,7 @@ #import "LLTitleSliderCell.h" #import "LLDetailTitleCell.h" #import "LLConst.h" +#import "LLMacros.h" @implementation LLTitleCellModel @@ -62,6 +63,16 @@ - (instancetype)initWithTitle:(NSString *)title value:(CGFloat)value minValue:(C return self; } +- (LLTitleCellModel *)normalInsets { + self.separatorInsets = UIEdgeInsetsMake(0, kLLGeneralMargin, 0, 0); + return self; +} + +- (LLTitleCellModel *)noneInsets { + self.separatorInsets = UIEdgeInsetsMake(0, LL_SCREEN_WIDTH, 0, 0); + return self; +} + - (void)setBlock:(LLSettingModelBlock)block { if (_block != block) { _block = [block copy]; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h index d2d7cb09..5de2cfad 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h @@ -38,6 +38,8 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *_Nullable)viewContentModeDescription:(UIViewContentMode)mode; ++ (NSArray *)viewContentModeDescriptions; + + (NSString *_Nullable)textAlignmentDescription:(NSTextAlignment)textAlignment; + (NSString *_Nullable)baselineAdjustmentDescription:(UIBaselineAdjustment)baselineAdjustment; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m index d4869cd4..220f3c69 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m @@ -110,6 +110,17 @@ + (NSString *_Nullable)viewContentModeDescription:(UIViewContentMode)mode { return nil; } ++ (NSArray *)viewContentModeDescriptions { + NSMutableArray *descriptions = [[NSMutableArray alloc] init]; + for (UIViewContentMode i = UIViewContentModeScaleToFill; i <= UIViewContentModeBottomRight; i++) { + NSString *description = [self viewContentModeDescription:i]; + if (description) { + [descriptions addObject:description]; + } + } + return [descriptions copy]; +} + + (NSString *)textAlignmentDescription:(NSTextAlignment)textAlignment { switch (textAlignment) { case NSTextAlignmentLeft: From 3a1d5636dd5ad08584abcc26532d602ce7b01fd3 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Fri, 25 Oct 2019 17:28:14 +0800 Subject: [PATCH 07/45] Refactory. --- .../Function/NSObject+LL_Hierarchy.m | 366 +++++++++--------- 1 file changed, 180 insertions(+), 186 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 21e31d47..dea8581d 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -38,28 +38,18 @@ @implementation NSObject (LL_Hierarchy) NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Class Name" detailTitle:NSStringFromClass(self.class)]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Class Name" detailTitle:NSStringFromClass(self.class)] noneInsets]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Address" detailTitle:[NSString stringWithFormat:@"%p",self]]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Address" detailTitle:[NSString stringWithFormat:@"%p",self]] noneInsets]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Description" detailTitle:self.description]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Description" detailTitle:self.description] noneInsets]; [settings addObject:model3]; return @[[[LLTitleCellCategoryModel alloc] initWithTitle:@"Object" items:settings]]; } -- (LLTitleCellModel *)LL_noneInsetsCellModelWithTitle:(NSString *)title detailTitle:(NSString *)detailTitle { - return [self LL_cellModelWithTitle:title detailTitle:detailTitle insets:UIEdgeInsetsMake(0, LL_SCREEN_WIDTH, 0, 0)]; -} - -- (LLTitleCellModel *)LL_cellModelWithTitle:(NSString *)title detailTitle:(NSString *)detailTitle insets:(UIEdgeInsets)insets { - LLTitleCellModel *model = [[LLTitleCellModel alloc] initWithTitle:title detailTitle:detailTitle]; - model.separatorInsets = insets; - return model; -} - - (NSString *)LL_hierarchyColorDescription:(UIColor *_Nullable)color { if (!color) { return @""; @@ -150,13 +140,13 @@ @implementation UIView (LL_Hierarchy) NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Layer" detailTitle:self.layer.description]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Layer" detailTitle:self.layer.description] noneInsets]; [settings addObject:model1]; LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Layer Class" detailTitle:NSStringFromClass(self.layer.class)]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Content Model" detailTitle:[LLEnumDescription viewContentModeDescription:self.contentMode]]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Content Model" detailTitle:[LLEnumDescription viewContentModeDescription:self.contentMode]] noneInsets]; model3.block = ^{ [weakSelf LL_showActionSheetWithActions:[LLEnumDescription viewContentModeDescriptions] currentAction:[LLEnumDescription viewContentModeDescription:weakSelf.contentMode] completion:^(NSInteger index) { weakSelf.contentMode = index; @@ -172,48 +162,52 @@ @implementation UIView (LL_Hierarchy) }; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Interaction" detailTitle:[NSString stringWithFormat:@"User Interaction Enabled %@",[self LL_hierarchyBoolDescription:self.isUserInteractionEnabled]]]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"User Interaction" flag: self.isUserInteractionEnabled] noneInsets]; + model5.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.userInteractionEnabled = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model5]; LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Multiple Touch %@", [self LL_hierarchyBoolDescription:self.isMultipleTouchEnabled]]]; [settings addObject:model6]; - LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Alpha" detailTitle:[LLFormatterTool formatNumber:@(self.alpha)]]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Alpha" detailTitle:[LLFormatterTool formatNumber:@(self.alpha)]] noneInsets]; [settings addObject:model7]; - LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:@"Background" detailTitle:[self LL_hierarchyColorDescription:self.backgroundColor]]; + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Background" detailTitle:[self LL_hierarchyColorDescription:self.backgroundColor]] noneInsets]; [settings addObject:model8]; LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Tint" detailTitle:[self LL_hierarchyColorDescription:self.tintColor]]; [settings addObject:model9]; - LLTitleCellModel *model10 = [self LL_noneInsetsCellModelWithTitle:@"Drawing" detailTitle:[NSString stringWithFormat:@"Opaque %@",[self LL_hierarchyBoolDescription:self.isOpaque]]]; + LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Drawing" detailTitle:[NSString stringWithFormat:@"Opaque %@",[self LL_hierarchyBoolDescription:self.isOpaque]]] noneInsets]; [settings addObject:model10]; - LLTitleCellModel *model11 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Hidden %@",[self LL_hierarchyBoolDescription:self.isHidden]]]; + LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Hidden %@",[self LL_hierarchyBoolDescription:self.isHidden]]] noneInsets]; [settings addObject:model11]; - LLTitleCellModel *model12 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clears Graphics Context %@",[self LL_hierarchyBoolDescription:self.clearsContextBeforeDrawing]]]; + LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clears Graphics Context %@",[self LL_hierarchyBoolDescription:self.clearsContextBeforeDrawing]]] noneInsets]; [settings addObject:model12]; - LLTitleCellModel *model13 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clip To Bounds %@",[self LL_hierarchyBoolDescription:self.clipsToBounds]]]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clip To Bounds %@",[self LL_hierarchyBoolDescription:self.clipsToBounds]]] noneInsets]; [settings addObject:model13]; LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Autoresizes Subviews %@", [self LL_hierarchyBoolDescription:self.autoresizesSubviews]]]; [settings addObject:model14]; - LLTitleCellModel *model15 = [self LL_noneInsetsCellModelWithTitle:@"Trait Collection" detailTitle:nil]; + LLTitleCellModel *model15 = [[[LLTitleCellModel alloc] initWithTitle:@"Trait Collection" detailTitle:nil] noneInsets]; [settings addObject:model15]; if (@available(iOS 12.0, *)) { - LLTitleCellModel *model16 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[LLEnumDescription userInterfaceStyleDescription:self.traitCollection.userInterfaceStyle]]; + LLTitleCellModel *model16 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[LLEnumDescription userInterfaceStyleDescription:self.traitCollection.userInterfaceStyle]] noneInsets]; [settings addObject:model16]; } - LLTitleCellModel *model17 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[@"Vertical" stringByAppendingFormat:@" %@",[LLEnumDescription userInterfaceSizeClassDescription:self.traitCollection.verticalSizeClass]]]; + LLTitleCellModel *model17 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[@"Vertical" stringByAppendingFormat:@" %@",[LLEnumDescription userInterfaceSizeClassDescription:self.traitCollection.verticalSizeClass]]] noneInsets]; [settings addObject:model17]; - LLTitleCellModel *model18 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[@"Horizontal" stringByAppendingFormat:@" %@",[LLEnumDescription userInterfaceSizeClassDescription:self.traitCollection.horizontalSizeClass]]]; + LLTitleCellModel *model18 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[@"Horizontal" stringByAppendingFormat:@" %@",[LLEnumDescription userInterfaceSizeClassDescription:self.traitCollection.horizontalSizeClass]]] noneInsets]; [settings addObject:model18]; if (@available(iOS 10.0, *)) { @@ -239,43 +233,43 @@ @implementation UILabel (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Text" detailTitle:[self LL_hierarchyTextDescription:self.text]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Text" detailTitle:[self LL_hierarchyTextDescription:self.text]] noneInsets]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:self.attributedText == nil ? @"Plain Text" : @"Attributed Text"]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:self.attributedText == nil ? @"Plain Text" : @"Attributed Text"] noneInsets]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Text" detailTitle:[self LL_hierarchyColorDescription:self.textColor]]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Text" detailTitle:[self LL_hierarchyColorDescription:self.textColor]] noneInsets]; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[self LL_hierarchyObjectDescription:self.font]]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyObjectDescription:self.font]] noneInsets]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Aligned %@", [LLEnumDescription textAlignmentDescription:self.textAlignment]]]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Aligned %@", [LLEnumDescription textAlignmentDescription:self.textAlignment]]] noneInsets]; [settings addObject:model5]; - LLTitleCellModel *model6 = [self LL_noneInsetsCellModelWithTitle:@"Lines" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.numberOfLines]]; + LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Lines" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.numberOfLines]] noneInsets]; [settings addObject:model6]; - LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Enabled %@",[self LL_hierarchyBoolDescription:self.isEnabled]]]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Enabled %@",[self LL_hierarchyBoolDescription:self.isEnabled]]] noneInsets]; [settings addObject:model7]; LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Highlighted %@", [self LL_hierarchyBoolDescription:self.isHighlighted]]]; [settings addObject:model8]; - LLTitleCellModel *model9 = [self LL_noneInsetsCellModelWithTitle:@"Baseline" detailTitle:[NSString stringWithFormat:@"Align %@",[LLEnumDescription baselineAdjustmentDescription:self.baselineAdjustment]]]; + LLTitleCellModel *model9 = [[[LLTitleCellModel alloc] initWithTitle:@"Baseline" detailTitle:[NSString stringWithFormat:@"Align %@",[LLEnumDescription baselineAdjustmentDescription:self.baselineAdjustment]]] noneInsets]; [settings addObject:model9]; - LLTitleCellModel *model10 = [self LL_noneInsetsCellModelWithTitle:@"Line Break" detailTitle:[LLEnumDescription lineBreakModeDescription:self.lineBreakMode]]; + LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Line Break" detailTitle:[LLEnumDescription lineBreakModeDescription:self.lineBreakMode]] noneInsets]; [settings addObject:model10]; LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:@"Min Font Scale" detailTitle:[LLFormatterTool formatNumber:@(self.minimumScaleFactor)]]; [settings addObject:model11]; - LLTitleCellModel *model12 = [self LL_noneInsetsCellModelWithTitle:@"Highlighted" detailTitle:[self LL_hierarchyColorDescription:self.highlightedTextColor]]; + LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Highlighted" detailTitle:[self LL_hierarchyColorDescription:self.highlightedTextColor]] noneInsets]; [settings addObject:model12]; - LLTitleCellModel *model13 = [self LL_noneInsetsCellModelWithTitle:@"Shadow" detailTitle:[self LL_hierarchyColorDescription:self.shadowColor]]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:@"Shadow" detailTitle:[self LL_hierarchyColorDescription:self.shadowColor]] noneInsets]; [settings addObject:model13]; LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:self.shadowOffset]]; @@ -299,16 +293,16 @@ @implementation UIControl (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Alignment" detailTitle:[NSString stringWithFormat:@"%@ Horizonally", [LLEnumDescription controlContentHorizontalAlignmentDescription:self.contentHorizontalAlignment]]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Alignment" detailTitle:[NSString stringWithFormat:@"%@ Horizonally", [LLEnumDescription controlContentHorizontalAlignmentDescription:self.contentHorizontalAlignment]]] noneInsets]; [settings addObject:model1]; LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"%@ Vertically", [LLEnumDescription controlContentVerticalAlignmentDescription:self.contentVerticalAlignment]]]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Content" detailTitle:self.isSelected ? @"Selected" : @"Not Selected"]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Content" detailTitle:self.isSelected ? @"Selected" : @"Not Selected"] noneInsets]; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:self.isEnabled ? @"Enabled" : @"Not Enabled"]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:self.isEnabled ? @"Enabled" : @"Not Enabled"] noneInsets]; [settings addObject:model4]; LLTitleCellModel *model5 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:self.isHighlighted ? @"Highlighted" : @"Not Highlighted"]; @@ -338,10 +332,10 @@ @implementation UIButton (LL_Hierarchy) LLTitleCellModel *model1 = [[LLTitleCellModel alloc] initWithTitle:@"Type" detailTitle:[LLEnumDescription buttonTypeDescription:self.buttonType]]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"State" detailTitle:[LLEnumDescription controlStateDescription:self.state]]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"State" detailTitle:[LLEnumDescription controlStateDescription:self.state]] noneInsets]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Title" detailTitle:[self LL_hierarchyTextDescription:self.currentTitle]]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Title" detailTitle:[self LL_hierarchyTextDescription:self.currentTitle]] noneInsets]; model3.block = ^{ [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.currentTitle handler:^(NSString * _Nullable newText) { [weakSelf setTitle:newText forState:weakSelf.state]; @@ -349,17 +343,17 @@ @implementation UIButton (LL_Hierarchy) }; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:self.currentAttributedTitle == nil ? @"Plain Text" : @"Attributed Text"]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:self.currentAttributedTitle == nil ? @"Plain Text" : @"Attributed Text"] noneInsets]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Text Color" detailTitle:[self LL_hierarchyColorDescription:self.currentTitleColor]]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Text Color" detailTitle:[self LL_hierarchyColorDescription:self.currentTitleColor]] noneInsets]; [settings addObject:model5]; LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Shadow Color" detailTitle:[self LL_hierarchyColorDescription:self.currentTitleShadowColor]]; [settings addObject:model6]; id target = self.allTargets.allObjects.firstObject; - LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Target" detailTitle:target ? [NSString stringWithFormat:@"%@",target] : @""]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Target" detailTitle:target ? [NSString stringWithFormat:@"%@",target] : @""] noneInsets]; [settings addObject:model7]; LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:@"Action" detailTitle:[self LL_hierarchyTextDescription:[self actionsForTarget:target forControlEvent:UIControlEventTouchUpInside].firstObject]];; @@ -370,20 +364,20 @@ @implementation UIButton (LL_Hierarchy) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - LLTitleCellModel *model10 = [self LL_noneInsetsCellModelWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:self.titleShadowOffset]]; + LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:self.titleShadowOffset]] noneInsets]; [settings addObject:model10]; #pragma clang diagnostic pop - LLTitleCellModel *model11 = [self LL_noneInsetsCellModelWithTitle:@"On Highlight" detailTitle:self.reversesTitleShadowWhenHighlighted ? @"Shadow Reverses" : @"Normal Shadow"]; + LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:@"On Highlight" detailTitle:self.reversesTitleShadowWhenHighlighted ? @"Shadow Reverses" : @"Normal Shadow"] noneInsets]; [settings addObject:model11]; - LLTitleCellModel *model12 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:self.showsTouchWhenHighlighted ? @"Shows Touch" : @"Doesn't Show Touch"]; + LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:self.showsTouchWhenHighlighted ? @"Shows Touch" : @"Doesn't Show Touch"] noneInsets]; [settings addObject:model12]; - LLTitleCellModel *model13 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:self.adjustsImageWhenHighlighted ? @"Adjusts Image" : @"No Image Adjustment"]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:self.adjustsImageWhenHighlighted ? @"Adjusts Image" : @"No Image Adjustment"] noneInsets]; [settings addObject:model13]; - LLTitleCellModel *model14 = [self LL_noneInsetsCellModelWithTitle:@"When Disabled" detailTitle:self.adjustsImageWhenDisabled ? @"Adjusts Image" : @"No Image Adjustment"]; + LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:@"When Disabled" detailTitle:self.adjustsImageWhenDisabled ? @"Adjusts Image" : @"No Image Adjustment"] noneInsets]; [settings addObject:model14]; #pragma clang diagnostic push @@ -392,19 +386,19 @@ @implementation UIButton (LL_Hierarchy) [settings addObject:model15]; #pragma clang diagnostic pop - LLTitleCellModel *model16 = [self LL_noneInsetsCellModelWithTitle:@"Content Insets" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.contentEdgeInsets]]; + LLTitleCellModel *model16 = [[[LLTitleCellModel alloc] initWithTitle:@"Content Insets" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.contentEdgeInsets]] noneInsets]; [settings addObject:model16]; - LLTitleCellModel *model17 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.contentEdgeInsets]]; + LLTitleCellModel *model17 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.contentEdgeInsets]] noneInsets]; [settings addObject:model17]; - LLTitleCellModel *model18 = [self LL_noneInsetsCellModelWithTitle:@"Title Insets" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.titleEdgeInsets]]; + LLTitleCellModel *model18 = [[[LLTitleCellModel alloc] initWithTitle:@"Title Insets" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.titleEdgeInsets]] noneInsets]; [settings addObject:model18]; - LLTitleCellModel *model19 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.titleEdgeInsets]]; + LLTitleCellModel *model19 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.titleEdgeInsets]] noneInsets]; [settings addObject:model19]; - LLTitleCellModel *model20 = [self LL_noneInsetsCellModelWithTitle:@"Image Insets" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.imageEdgeInsets]]; + LLTitleCellModel *model20 = [[[LLTitleCellModel alloc] initWithTitle:@"Image Insets" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.imageEdgeInsets]] noneInsets]; [settings addObject:model20]; LLTitleCellModel *model21 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.imageEdgeInsets]]; @@ -455,28 +449,28 @@ @implementation UITextField (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Plain Text" detailTitle:[self LL_hierarchyTextDescription:self.text]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Plain Text" detailTitle:[self LL_hierarchyTextDescription:self.text]] noneInsets]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Attributed Text" detailTitle:[self LL_hierarchyObjectDescription:self.attributedText]]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Attributed Text" detailTitle:[self LL_hierarchyObjectDescription:self.attributedText]] noneInsets]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Allows Editing Attributes %@", [self LL_hierarchyBoolDescription:self.allowsEditingTextAttributes]]]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Allows Editing Attributes %@", [self LL_hierarchyBoolDescription:self.allowsEditingTextAttributes]]] noneInsets]; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.textColor]]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.textColor]] noneInsets]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Font" detailTitle:[self LL_hierarchyObjectDescription:self.font]]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Font" detailTitle:[self LL_hierarchyObjectDescription:self.font]] noneInsets]; [settings addObject:model5]; - LLTitleCellModel *model6 = [self LL_noneInsetsCellModelWithTitle:@"Alignment" detailTitle:[LLEnumDescription textAlignmentDescription:self.textAlignment]]; + LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Alignment" detailTitle:[LLEnumDescription textAlignmentDescription:self.textAlignment]] noneInsets]; [settings addObject:model6]; LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:@"Placeholder" detailTitle:[self LL_hierarchyTextDescription:self.placeholder ?: self.attributedPlaceholder.string]]; [settings addObject:model7]; - LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:@"Background" detailTitle: [self LL_hierarchyImageDescription:self.background]]; + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Background" detailTitle: [self LL_hierarchyImageDescription:self.background]] noneInsets]; [settings addObject:model8]; LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Disabled" detailTitle: [self LL_hierarchyImageDescription:self.disabledBackground]]; @@ -485,34 +479,34 @@ @implementation UITextField (LL_Hierarchy) LLTitleCellModel *model10 = [[LLTitleCellModel alloc] initWithTitle:@"Border Style" detailTitle:[LLEnumDescription textBorderStyleDescription:self.borderStyle]]; [settings addObject:model10]; - LLTitleCellModel *model11 = [self LL_noneInsetsCellModelWithTitle:@"Clear Button" detailTitle:[LLEnumDescription textFieldViewModeDescription:self.clearButtonMode]]; + LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:@"Clear Button" detailTitle:[LLEnumDescription textFieldViewModeDescription:self.clearButtonMode]] noneInsets]; [settings addObject:model11]; LLTitleCellModel *model12 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clear when editing begins %@", [self LL_hierarchyBoolDescription:self.clearsOnBeginEditing]]]; [settings addObject:model12]; - LLTitleCellModel *model13 = [self LL_noneInsetsCellModelWithTitle:@"Min Font Size" detailTitle:[LLFormatterTool formatNumber:@(self.minimumFontSize)]]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Font Size" detailTitle:[LLFormatterTool formatNumber:@(self.minimumFontSize)]] noneInsets]; [settings addObject:model13]; LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Adjusts to Fit %@",[self LL_hierarchyBoolDescription:self.adjustsFontSizeToFitWidth]]]; [settings addObject:model14]; - LLTitleCellModel *model15 = [self LL_noneInsetsCellModelWithTitle:@"Capitalization" detailTitle:[LLEnumDescription textAutocapitalizationTypeDescription:self.autocapitalizationType]]; + LLTitleCellModel *model15 = [[[LLTitleCellModel alloc] initWithTitle:@"Capitalization" detailTitle:[LLEnumDescription textAutocapitalizationTypeDescription:self.autocapitalizationType]] noneInsets]; [settings addObject:model15]; - LLTitleCellModel *model16 = [self LL_noneInsetsCellModelWithTitle:@"Correction" detailTitle:[LLEnumDescription textAutocorrectionTypeDescription:self.autocorrectionType]]; + LLTitleCellModel *model16 = [[[LLTitleCellModel alloc] initWithTitle:@"Correction" detailTitle:[LLEnumDescription textAutocorrectionTypeDescription:self.autocorrectionType]] noneInsets]; [settings addObject:model16]; - LLTitleCellModel *model17 = [self LL_noneInsetsCellModelWithTitle:@"Keyboard" detailTitle:[LLEnumDescription keyboardTypeDescription:self.keyboardType]]; + LLTitleCellModel *model17 = [[[LLTitleCellModel alloc] initWithTitle:@"Keyboard" detailTitle:[LLEnumDescription keyboardTypeDescription:self.keyboardType]] noneInsets]; [settings addObject:model17]; - LLTitleCellModel *model18 = [self LL_noneInsetsCellModelWithTitle:@"Appearance" detailTitle:[LLEnumDescription keyboardAppearanceDescription:self.keyboardAppearance]]; + LLTitleCellModel *model18 = [[[LLTitleCellModel alloc] initWithTitle:@"Appearance" detailTitle:[LLEnumDescription keyboardAppearanceDescription:self.keyboardAppearance]] noneInsets]; [settings addObject:model18]; - LLTitleCellModel *model19 = [self LL_noneInsetsCellModelWithTitle:@"Return Key" detailTitle:[LLEnumDescription returnKeyTypeDescription:self.returnKeyType]]; + LLTitleCellModel *model19 = [[[LLTitleCellModel alloc] initWithTitle:@"Return Key" detailTitle:[LLEnumDescription returnKeyTypeDescription:self.returnKeyType]] noneInsets]; [settings addObject:model19]; - LLTitleCellModel *model20 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Auto-enable Return Key %@", [self LL_hierarchyBoolDescription:self.enablesReturnKeyAutomatically]]]; + LLTitleCellModel *model20 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Auto-enable Return Key %@", [self LL_hierarchyBoolDescription:self.enablesReturnKeyAutomatically]]] noneInsets]; [settings addObject:model20]; LLTitleCellModel *model21 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Secure Entry %@",[self LL_hierarchyBoolDescription:self.secureTextEntry]]]; @@ -536,21 +530,21 @@ @implementation UISegmentedControl (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Behavior" detailTitle:self.isMomentary ? @"Momentary" : @"Persistent Selection"]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:self.isMomentary ? @"Momentary" : @"Persistent Selection"] noneInsets]; [settings addObject:model1]; LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Segments" detailTitle:[NSString stringWithFormat:@"%ld",(unsigned long)self.numberOfSegments]]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Selected Index" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.selectedSegmentIndex]]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Selected Index" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.selectedSegmentIndex]] noneInsets]; [settings addObject:model3]; #ifdef __IPHONE_13_0 if (@available(iOS 13.0, *)) { - LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:@"Title" detailTitle:[self LL_hierarchyTextDescription:self.largeContentTitle]]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Title" detailTitle:[self LL_hierarchyTextDescription:self.largeContentTitle]] noneInsets]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Image" detailTitle: [self LL_hierarchyImageDescription:self.largeContentImage]]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Image" detailTitle: [self LL_hierarchyImageDescription:self.largeContentImage]] noneInsets]; [settings addObject:model5]; } #endif @@ -558,10 +552,10 @@ @implementation UISegmentedControl (LL_Hierarchy) LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Selected" detailTitle:[self isEnabledForSegmentAtIndex:self.selectedSegmentIndex] ? @"Enabled" : @"Not Enabled"]; [settings addObject:model6]; - LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Offset" detailTitle:[self LL_hierarchySizeDescription:[self contentOffsetForSegmentAtIndex:self.selectedSegmentIndex]]]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Offset" detailTitle:[self LL_hierarchySizeDescription:[self contentOffsetForSegmentAtIndex:self.selectedSegmentIndex]]] noneInsets]; [settings addObject:model7]; - LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:@"Size Mode" detailTitle:self.apportionsSegmentWidthsByContent ? @"Proportional to Content" : @"Equal Widths"]; + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Size Mode" detailTitle:self.apportionsSegmentWidthsByContent ? @"Proportional to Content" : @"Equal Widths"] noneInsets]; [settings addObject:model8]; LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Width" detailTitle:[LLFormatterTool formatNumber:@([self widthForSegmentAtIndex:self.selectedSegmentIndex])]]; @@ -585,25 +579,25 @@ @implementation UISlider (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Current" detailTitle:[LLFormatterTool formatNumber:@(self.value)]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Current" detailTitle:[LLFormatterTool formatNumber:@(self.value)]] noneInsets]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Minimum" detailTitle:[LLFormatterTool formatNumber:@(self.minimumValue)]]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Minimum" detailTitle:[LLFormatterTool formatNumber:@(self.minimumValue)]] noneInsets]; [settings addObject:model2]; LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Maximum" detailTitle:[LLFormatterTool formatNumber:@(self.maximumValue)]]; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:@"Min Image" detailTitle: [self LL_hierarchyImageDescription:self.minimumValueImage]]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Image" detailTitle: [self LL_hierarchyImageDescription:self.minimumValueImage]] noneInsets]; [settings addObject:model4]; LLTitleCellModel *model5 = [[LLTitleCellModel alloc] initWithTitle:@"Max Image" detailTitle: [self LL_hierarchyImageDescription:self.maximumValueImage]]; [settings addObject:model5]; - LLTitleCellModel *model6 = [self LL_noneInsetsCellModelWithTitle:@"Min Track Tint" detailTitle:[self LL_hierarchyColorDescription:self.minimumTrackTintColor]]; + LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Track Tint" detailTitle:[self LL_hierarchyColorDescription:self.minimumTrackTintColor]] noneInsets]; [settings addObject:model6]; - LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Max Track Tint" detailTitle:[self LL_hierarchyColorDescription:self.maximumTrackTintColor]]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Max Track Tint" detailTitle:[self LL_hierarchyColorDescription:self.maximumTrackTintColor]] noneInsets]; [settings addObject:model7]; LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:@"Thumb Tint" detailTitle:[self LL_hierarchyColorDescription:self.tintColor]]; @@ -630,10 +624,10 @@ @implementation UISwitch (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"State" detailTitle:[self LL_hierarchyBoolDescription:self.isOn]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"State" detailTitle:[self LL_hierarchyBoolDescription:self.isOn]] noneInsets]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"On Tint" detailTitle:[self LL_hierarchyColorDescription:self.onTintColor]]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"On Tint" detailTitle:[self LL_hierarchyColorDescription:self.onTintColor]] noneInsets]; [settings addObject:model2]; LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Thumb Tint" detailTitle:[self LL_hierarchyColorDescription:self.thumbTintColor]]; @@ -657,13 +651,13 @@ @implementation UIActivityIndicatorView (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Style" detailTitle:[LLEnumDescription activityIndicatorViewStyleDescription:self.activityIndicatorViewStyle]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription activityIndicatorViewStyleDescription:self.activityIndicatorViewStyle]] noneInsets]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.color]]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.color]] noneInsets]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Animating %@", [self LL_hierarchyBoolDescription:self.isAnimating]]]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Animating %@", [self LL_hierarchyBoolDescription:self.isAnimating]]] noneInsets]; [settings addObject:model3]; LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Hides When Stopped %@", [self LL_hierarchyBoolDescription:self.hidesWhenStopped]]]; @@ -693,13 +687,13 @@ @implementation UIProgressView (LL_Hierarchy) LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Progress" detailTitle:[LLFormatterTool formatNumber:@(self.progress)]]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Progress Tint" detailTitle:[self LL_hierarchyColorDescription:self.progressTintColor]]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Progress Tint" detailTitle:[self LL_hierarchyColorDescription:self.progressTintColor]] noneInsets]; [settings addObject:model3]; LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:@"Track Tint" detailTitle:[self LL_hierarchyColorDescription:self.trackTintColor]]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Progress Image" detailTitle:[self LL_hierarchyImageDescription:self.progressImage]]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Progress Image" detailTitle:[self LL_hierarchyImageDescription:self.progressImage]] noneInsets]; [settings addObject:model5]; LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Track Image" detailTitle:[self LL_hierarchyImageDescription:self.trackImage]]; @@ -723,19 +717,19 @@ @implementation UIPageControl (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Pages" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.numberOfPages]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Pages" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.numberOfPages]] noneInsets]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Current Page" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.currentPage]]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Current Page" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.currentPage]] noneInsets]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Hides for Single Page %@",[self LL_hierarchyBoolDescription:self.hidesForSinglePage]]]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Hides for Single Page %@",[self LL_hierarchyBoolDescription:self.hidesForSinglePage]]] noneInsets]; [settings addObject:model3]; LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Defers Page Display %@", [self LL_hierarchyBoolDescription:self.defersCurrentPageDisplay]]]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Tint Color" detailTitle:[self LL_hierarchyColorDescription:self.pageIndicatorTintColor]]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Tint Color" detailTitle:[self LL_hierarchyColorDescription:self.pageIndicatorTintColor]] noneInsets]; [settings addObject:model5]; LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Current Page" detailTitle:[self LL_hierarchyColorDescription:self.currentPageIndicatorTintColor]]; @@ -759,22 +753,22 @@ @implementation UIStepper (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Value" detailTitle:[LLFormatterTool formatNumber:@(self.value)]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Value" detailTitle:[LLFormatterTool formatNumber:@(self.value)]] noneInsets]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Minimum" detailTitle:[LLFormatterTool formatNumber:@(self.minimumValue)]]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Minimum" detailTitle:[LLFormatterTool formatNumber:@(self.minimumValue)]] noneInsets]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Maximum" detailTitle:[LLFormatterTool formatNumber:@(self.maximumValue)]]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Maximum" detailTitle:[LLFormatterTool formatNumber:@(self.maximumValue)]] noneInsets]; [settings addObject:model3]; LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:@"Step" detailTitle:[LLFormatterTool formatNumber:@(self.stepValue)]]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Autorepeat %@",[self LL_hierarchyBoolDescription:self.autorepeat]]]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Autorepeat %@",[self LL_hierarchyBoolDescription:self.autorepeat]]] noneInsets]; [settings addObject:model5]; - LLTitleCellModel *model6 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Continuous %@",[self LL_hierarchyBoolDescription:self.continuous]]]; + LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Continuous %@",[self LL_hierarchyBoolDescription:self.continuous]]] noneInsets]; [settings addObject:model6]; LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Wrap %@",[self LL_hierarchyBoolDescription:self.wraps]]]; @@ -801,40 +795,40 @@ @implementation UIScrollView (LL_Hierarchy) LLTitleCellModel *model1 = [[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription scrollViewIndicatorStyleDescription:self.indicatorStyle]]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Indicators" detailTitle:[NSString stringWithFormat:@"Shows Horizontal Indicator %@",[self LL_hierarchyBoolDescription:self.showsHorizontalScrollIndicator]]]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Indicators" detailTitle:[NSString stringWithFormat:@"Shows Horizontal Indicator %@",[self LL_hierarchyBoolDescription:self.showsHorizontalScrollIndicator]]] noneInsets]; [settings addObject:model2]; LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Vertical Indicator %@",[self LL_hierarchyBoolDescription:self.showsVerticalScrollIndicator]]]; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:@"Scrolling" detailTitle:[NSString stringWithFormat:@"Scrolling %@", self.scrollEnabled ? @"Enabled" : @"Not Enabled"]]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Scrolling" detailTitle:[NSString stringWithFormat:@"Scrolling %@", self.scrollEnabled ? @"Enabled" : @"Not Enabled"]] noneInsets]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Paging %@", self.pagingEnabled ? @"Enabled" : @"Disabled"]]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Paging %@", self.pagingEnabled ? @"Enabled" : @"Disabled"]] noneInsets]; [settings addObject:model5]; LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Direction Lock %@",self.isDirectionalLockEnabled ? @"Enabled" : @"Disabled"]]; [settings addObject:model6]; - LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Bounce" detailTitle:[NSString stringWithFormat:@"Bounces %@",[self LL_hierarchyBoolDescription:self.bounces]]]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Bounce" detailTitle:[NSString stringWithFormat:@"Bounces %@",[self LL_hierarchyBoolDescription:self.bounces]]] noneInsets]; [settings addObject:model7]; - LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Bounce Horizontal %@",[self LL_hierarchyBoolDescription:self.alwaysBounceHorizontal]]]; + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Bounce Horizontal %@",[self LL_hierarchyBoolDescription:self.alwaysBounceHorizontal]]] noneInsets]; [settings addObject:model8]; LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Bounce Vertical %@",[self LL_hierarchyBoolDescription:self.alwaysBounceVertical]]]; [settings addObject:model9]; - LLTitleCellModel *model10 = [self LL_noneInsetsCellModelWithTitle:@"Zoom Min" detailTitle:[LLFormatterTool formatNumber:@(self.minimumZoomScale)]]; + LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Zoom Min" detailTitle:[LLFormatterTool formatNumber:@(self.minimumZoomScale)]] noneInsets]; [settings addObject:model10]; LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:@"Max" detailTitle:[LLFormatterTool formatNumber:@(self.maximumZoomScale)]]; [settings addObject:model11]; - LLTitleCellModel *model12 = [self LL_noneInsetsCellModelWithTitle:@"Touch" detailTitle:[NSString stringWithFormat:@"Zoom Bounces %@",[self LL_hierarchyBoolDescription:self.isZoomBouncing]]]; + LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Touch" detailTitle:[NSString stringWithFormat:@"Zoom Bounces %@",[self LL_hierarchyBoolDescription:self.isZoomBouncing]]] noneInsets]; [settings addObject:model12]; - LLTitleCellModel *model13 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Delays Content Touches %@",[self LL_hierarchyBoolDescription:self.delaysContentTouches]]]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Delays Content Touches %@",[self LL_hierarchyBoolDescription:self.delaysContentTouches]]] noneInsets]; [settings addObject:model13]; LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Cancellable Content Touches %@",[self LL_hierarchyBoolDescription:self.canCancelContentTouches]]]; @@ -861,28 +855,28 @@ @implementation UITableView (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Sections" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.numberOfSections]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Sections" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.numberOfSections]] noneInsets]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Style" detailTitle:[LLEnumDescription tableViewStyleDescription:self.style]]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription tableViewStyleDescription:self.style]] noneInsets]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Separator" detailTitle:[LLEnumDescription tableViewCellSeparatorStyleDescription:self.separatorStyle]]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Separator" detailTitle:[LLEnumDescription tableViewCellSeparatorStyleDescription:self.separatorStyle]] noneInsets]; [settings addObject:model3]; LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyColorDescription:self.separatorColor]]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Data Source" detailTitle:[self LL_hierarchyObjectDescription:self.dataSource]]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Data Source" detailTitle:[self LL_hierarchyObjectDescription:self.dataSource]] noneInsets]; [settings addObject:model5]; LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Delegate" detailTitle:[self LL_hierarchyObjectDescription:self.delegate]]; [settings addObject:model6]; - LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Separator Inset" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.separatorInset]]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Separator Inset" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.separatorInset]] noneInsets]; [settings addObject:model7]; - LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.separatorInset]]; + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.separatorInset]] noneInsets]; [settings addObject:model8]; if (@available(iOS 11.0, *)) { @@ -890,34 +884,34 @@ @implementation UITableView (LL_Hierarchy) [settings addObject:model9]; } - LLTitleCellModel *model10 = [self LL_noneInsetsCellModelWithTitle:@"Selection" detailTitle:self.allowsSelection ? @"Allowed" : @"Disabled"]; + LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Selection" detailTitle:self.allowsSelection ? @"Allowed" : @"Disabled"] noneInsets]; [settings addObject:model10]; - LLTitleCellModel *model11 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Multiple Selection %@",self.allowsMultipleSelection ? @"" : @"Disabled"]]; + LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Multiple Selection %@",self.allowsMultipleSelection ? @"" : @"Disabled"]] noneInsets]; [settings addObject:model11]; - LLTitleCellModel *model12 = [self LL_noneInsetsCellModelWithTitle:@"Edit Selection" detailTitle:self.allowsSelectionDuringEditing ? @"Allowed" : @"Disabled"]; + LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Edit Selection" detailTitle:self.allowsSelectionDuringEditing ? @"Allowed" : @"Disabled"] noneInsets]; [settings addObject:model12]; LLTitleCellModel *model13 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Multiple Selection %@",self.allowsMultipleSelection ? @"" : @"Disabled"]]; [settings addObject:model13]; - LLTitleCellModel *model14 = [self LL_noneInsetsCellModelWithTitle:@"Min Display" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.sectionIndexMinimumDisplayRowCount]]; + LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Display" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.sectionIndexMinimumDisplayRowCount]] noneInsets]; [settings addObject:model14]; - LLTitleCellModel *model15 = [self LL_noneInsetsCellModelWithTitle:@"Text" detailTitle:[self LL_hierarchyColorDescription:self.sectionIndexColor]]; + LLTitleCellModel *model15 = [[[LLTitleCellModel alloc] initWithTitle:@"Text" detailTitle:[self LL_hierarchyColorDescription:self.sectionIndexColor]] noneInsets]; [settings addObject:model15]; - LLTitleCellModel *model16 = [self LL_noneInsetsCellModelWithTitle:@"Background" detailTitle:[self LL_hierarchyColorDescription:self.sectionIndexBackgroundColor]]; + LLTitleCellModel *model16 = [[[LLTitleCellModel alloc] initWithTitle:@"Background" detailTitle:[self LL_hierarchyColorDescription:self.sectionIndexBackgroundColor]] noneInsets]; [settings addObject:model16]; LLTitleCellModel *model17 = [[LLTitleCellModel alloc] initWithTitle:@"Tracking" detailTitle:[self LL_hierarchyColorDescription:self.sectionIndexTrackingBackgroundColor]]; [settings addObject:model17]; - LLTitleCellModel *model18 = [self LL_noneInsetsCellModelWithTitle:@"Row Height" detailTitle:[LLFormatterTool formatNumber:@(self.rowHeight)]]; + LLTitleCellModel *model18 = [[[LLTitleCellModel alloc] initWithTitle:@"Row Height" detailTitle:[LLFormatterTool formatNumber:@(self.rowHeight)]] noneInsets]; [settings addObject:model18]; - LLTitleCellModel *model19 = [self LL_noneInsetsCellModelWithTitle:@"Section Header" detailTitle:[LLFormatterTool formatNumber:@(self.sectionHeaderHeight)]]; + LLTitleCellModel *model19 = [[[LLTitleCellModel alloc] initWithTitle:@"Section Header" detailTitle:[LLFormatterTool formatNumber:@(self.sectionHeaderHeight)]] noneInsets]; [settings addObject:model19]; LLTitleCellModel *model20 = [[LLTitleCellModel alloc] initWithTitle:@"Section Footer" detailTitle:[LLFormatterTool formatNumber:@(self.sectionFooterHeight)]]; @@ -948,28 +942,28 @@ @implementation UITableViewCell (LL_Hierarchy) LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Identifier" detailTitle:[self LL_hierarchyTextDescription:self.reuseIdentifier]]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Selection" detailTitle:[LLEnumDescription tableViewCellSelectionStyleDescription:self.selectionStyle]]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Selection" detailTitle:[LLEnumDescription tableViewCellSelectionStyleDescription:self.selectionStyle]] noneInsets]; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:@"Accessory" detailTitle:[LLEnumDescription tableViewCellAccessoryTypeDescription:self.accessoryType]]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Accessory" detailTitle:[LLEnumDescription tableViewCellAccessoryTypeDescription:self.accessoryType]] noneInsets]; [settings addObject:model4]; LLTitleCellModel *model5 = [[LLTitleCellModel alloc] initWithTitle:@"Editing Acc." detailTitle:[LLEnumDescription tableViewCellAccessoryTypeDescription:self.editingAccessoryType]]; [settings addObject:model5]; - LLTitleCellModel *model6 = [self LL_noneInsetsCellModelWithTitle:@"Indentation" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.indentationLevel]]; + LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Indentation" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.indentationLevel]] noneInsets]; [settings addObject:model6]; - LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[LLFormatterTool formatNumber:@(self.indentationWidth)]]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[LLFormatterTool formatNumber:@(self.indentationWidth)]] noneInsets]; [settings addObject:model7]; - LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Indent While Editing %@",[self LL_hierarchyBoolDescription:self.shouldIndentWhileEditing]]]; + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Indent While Editing %@",[self LL_hierarchyBoolDescription:self.shouldIndentWhileEditing]]] noneInsets]; [settings addObject:model8]; LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Re-order Controls %@",[self LL_hierarchyBoolDescription:self.showsReorderControl]]]; [settings addObject:model9]; - LLTitleCellModel *model10 = [self LL_noneInsetsCellModelWithTitle:@"Separator Inset" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.separatorInset]]; + LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Separator Inset" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.separatorInset]] noneInsets]; [settings addObject:model10]; LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.separatorInset]]; @@ -996,10 +990,10 @@ @implementation UICollectionView (LL_Hierarchy) LLTitleCellModel *model1 = [[LLTitleCellModel alloc] initWithTitle:@"Sections" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.numberOfSections]]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Delegate" detailTitle:[self LL_hierarchyObjectDescription:self.delegate]]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Delegate" detailTitle:[self LL_hierarchyObjectDescription:self.delegate]] noneInsets]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:@"Data Source" detailTitle:[self LL_hierarchyObjectDescription:self.dataSource]]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Data Source" detailTitle:[self LL_hierarchyObjectDescription:self.dataSource]] noneInsets]; [settings addObject:model3]; LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:@"Layout" detailTitle:[self LL_hierarchyObjectDescription:self.collectionViewLayout]]; @@ -1023,7 +1017,7 @@ @implementation UICollectionReusableView (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Identifier" detailTitle:[self LL_hierarchyTextDescription:self.reuseIdentifier]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Identifier" detailTitle:[self LL_hierarchyTextDescription:self.reuseIdentifier]] noneInsets]; [settings addObject:model1]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Collection Reusable View" items:settings]; @@ -1044,47 +1038,47 @@ @implementation UITextView (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Plain Text" detailTitle:[self LL_hierarchyTextDescription:self.text]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Plain Text" detailTitle:[self LL_hierarchyTextDescription:self.text]] noneInsets]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Attributed Text" detailTitle:[self LL_hierarchyObjectDescription:self.attributedText]]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Attributed Text" detailTitle:[self LL_hierarchyObjectDescription:self.attributedText]] noneInsets]; [settings addObject:model2]; - LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Allows Editing Attributes %@",[self LL_hierarchyBoolDescription:self.allowsEditingTextAttributes]]]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Allows Editing Attributes %@",[self LL_hierarchyBoolDescription:self.allowsEditingTextAttributes]]] noneInsets]; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.textColor]]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.textColor]] noneInsets]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Font" detailTitle:[self LL_hierarchyObjectDescription:self.font]]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Font" detailTitle:[self LL_hierarchyObjectDescription:self.font]] noneInsets]; [settings addObject:model5]; LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Alignment" detailTitle:[LLEnumDescription textAlignmentDescription:self.textAlignment]]; [settings addObject:model6]; - LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Editable %@",[self LL_hierarchyBoolDescription:self.isEditable]]]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Editable %@",[self LL_hierarchyBoolDescription:self.isEditable]]] noneInsets]; [settings addObject:model7]; LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Selectable %@",[self LL_hierarchyBoolDescription:self.isSelectable]]]; [settings addObject:model8]; - LLTitleCellModel *model9 = [self LL_noneInsetsCellModelWithTitle:@"Data Detectors" detailTitle:[NSString stringWithFormat:@"Phone Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypePhoneNumber]]]; + LLTitleCellModel *model9 = [[[LLTitleCellModel alloc] initWithTitle:@"Data Detectors" detailTitle:[NSString stringWithFormat:@"Phone Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypePhoneNumber]]] noneInsets]; [settings addObject:model9]; - LLTitleCellModel *model10 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Link %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeLink]]]; + LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Link %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeLink]]] noneInsets]; [settings addObject:model10]; - LLTitleCellModel *model11 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Address %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeAddress]]]; + LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Address %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeAddress]]] noneInsets]; [settings addObject:model11]; - LLTitleCellModel *model12 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Calendar Event %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeCalendarEvent]]]; + LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Calendar Event %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeCalendarEvent]]] noneInsets]; [settings addObject:model12]; if (@available(iOS 10.0, *)) { - LLTitleCellModel *model13 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shipment Tracking Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeShipmentTrackingNumber]]]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shipment Tracking Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeShipmentTrackingNumber]]] noneInsets]; [settings addObject:model13]; - LLTitleCellModel *model14 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Flight Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeFlightNumber]]]; + LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Flight Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeFlightNumber]]] noneInsets]; [settings addObject:model14]; LLTitleCellModel *model15 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Lookup Suggestion %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeLookupSuggestion]]]; @@ -1093,22 +1087,22 @@ @implementation UITextView (LL_Hierarchy) model12.separatorInsets = UIEdgeInsetsMake(0, kLLGeneralMargin, 0, 0); } - LLTitleCellModel *model16 = [self LL_noneInsetsCellModelWithTitle:@"Capitalization" detailTitle:[LLEnumDescription textAutocapitalizationTypeDescription:self.autocapitalizationType]]; + LLTitleCellModel *model16 = [[[LLTitleCellModel alloc] initWithTitle:@"Capitalization" detailTitle:[LLEnumDescription textAutocapitalizationTypeDescription:self.autocapitalizationType]] noneInsets]; [settings addObject:model16]; - LLTitleCellModel *model17 = [self LL_noneInsetsCellModelWithTitle:@"Correction" detailTitle:[LLEnumDescription textAutocorrectionTypeDescription:self.autocorrectionType]]; + LLTitleCellModel *model17 = [[[LLTitleCellModel alloc] initWithTitle:@"Correction" detailTitle:[LLEnumDescription textAutocorrectionTypeDescription:self.autocorrectionType]] noneInsets]; [settings addObject:model17]; - LLTitleCellModel *model18 = [self LL_noneInsetsCellModelWithTitle:@"Keyboard" detailTitle:[LLEnumDescription keyboardTypeDescription:self.keyboardType]]; + LLTitleCellModel *model18 = [[[LLTitleCellModel alloc] initWithTitle:@"Keyboard" detailTitle:[LLEnumDescription keyboardTypeDescription:self.keyboardType]] noneInsets]; [settings addObject:model18]; - LLTitleCellModel *model19 = [self LL_noneInsetsCellModelWithTitle:@"Appearance" detailTitle:[LLEnumDescription keyboardAppearanceDescription:self.keyboardAppearance]]; + LLTitleCellModel *model19 = [[[LLTitleCellModel alloc] initWithTitle:@"Appearance" detailTitle:[LLEnumDescription keyboardAppearanceDescription:self.keyboardAppearance]] noneInsets]; [settings addObject:model19]; - LLTitleCellModel *model20 = [self LL_noneInsetsCellModelWithTitle:@"Return Key" detailTitle:[LLEnumDescription returnKeyTypeDescription:self.returnKeyType]]; + LLTitleCellModel *model20 = [[[LLTitleCellModel alloc] initWithTitle:@"Return Key" detailTitle:[LLEnumDescription returnKeyTypeDescription:self.returnKeyType]] noneInsets]; [settings addObject:model20]; - LLTitleCellModel *model21 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Auto-enable Return Key %@",[self LL_hierarchyBoolDescription:self.enablesReturnKeyAutomatically]]]; + LLTitleCellModel *model21 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Auto-enable Return Key %@",[self LL_hierarchyBoolDescription:self.enablesReturnKeyAutomatically]]] noneInsets]; [settings addObject:model21]; LLTitleCellModel *model22 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Secure Entry %@",[self LL_hierarchyBoolDescription:self.isSecureTextEntry]]]; @@ -1132,25 +1126,25 @@ @implementation UIDatePicker (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Mode" detailTitle:[LLEnumDescription datePickerModeDescription:self.datePickerMode]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Mode" detailTitle:[LLEnumDescription datePickerModeDescription:self.datePickerMode]] noneInsets]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Locale Identifier" detailTitle:self.locale.localeIdentifier]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Locale Identifier" detailTitle:self.locale.localeIdentifier] noneInsets]; [settings addObject:model2]; LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Interval" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.minuteInterval]]; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:@"Date" detailTitle:[self LL_hierarchyObjectDescription:self.date]]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Date" detailTitle:[self LL_hierarchyObjectDescription:self.date]] noneInsets]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Min Date" detailTitle:[self LL_hierarchyObjectDescription:self.minimumDate]]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Date" detailTitle:[self LL_hierarchyObjectDescription:self.minimumDate]] noneInsets]; [settings addObject:model5]; LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Max Date" detailTitle:[self LL_hierarchyObjectDescription:self.maximumDate]]; [settings addObject:model6]; - LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Count Down" detailTitle:[LLFormatterTool formatNumber:@(self.countDownDuration)]]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Count Down" detailTitle:[LLFormatterTool formatNumber:@(self.countDownDuration)]] noneInsets]; [settings addObject:model7]; LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Count Down in Seconds"]; @@ -1195,36 +1189,36 @@ @implementation UINavigationBar (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Style" detailTitle:[LLEnumDescription barStyleDescription:self.barStyle]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription barStyleDescription:self.barStyle]] noneInsets]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]]]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]]] noneInsets]; [settings addObject:model2]; if (@available(iOS 11.0, *)) { - LLTitleCellModel *model3 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Prefers Large Titles %@",[self LL_hierarchyBoolDescription:self.prefersLargeTitles]]]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Prefers Large Titles %@",[self LL_hierarchyBoolDescription:self.prefersLargeTitles]]] noneInsets]; [settings addObject:model3]; } - LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:@"Bar Tint" detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Bar Tint" detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]] noneInsets]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Shadow Image" detailTitle:[self LL_hierarchyImageDescription:self.shadowImage]]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Shadow Image" detailTitle:[self LL_hierarchyImageDescription:self.shadowImage]] noneInsets]; [settings addObject:model5]; - LLTitleCellModel *model6 = [self LL_noneInsetsCellModelWithTitle:@"Back Image" detailTitle:[self LL_hierarchyImageDescription:self.backIndicatorImage]]; + LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Back Image" detailTitle:[self LL_hierarchyImageDescription:self.backIndicatorImage]] noneInsets]; [settings addObject:model6]; LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:@"Back Mask" detailTitle:[self LL_hierarchyImageDescription:self.backIndicatorTransitionMaskImage]]; [settings addObject:model7]; - LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:@"Title Attr." detailTitle:nil]; + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Title Attr." detailTitle:nil] noneInsets]; [settings addObject:model8]; - LLTitleCellModel *model9 = [self LL_noneInsetsCellModelWithTitle:@"Title Font" detailTitle:[self LL_hierarchyColorDescription:self.titleTextAttributes[NSFontAttributeName]]]; + LLTitleCellModel *model9 = [[[LLTitleCellModel alloc] initWithTitle:@"Title Font" detailTitle:[self LL_hierarchyColorDescription:self.titleTextAttributes[NSFontAttributeName]]] noneInsets]; [settings addObject:model9]; - LLTitleCellModel *model10 = [self LL_noneInsetsCellModelWithTitle:@"Title Color" detailTitle:[self LL_hierarchyColorDescription:self.titleTextAttributes[NSForegroundColorAttributeName]]]; + LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Title Color" detailTitle:[self LL_hierarchyColorDescription:self.titleTextAttributes[NSForegroundColorAttributeName]]] noneInsets]; [settings addObject:model10]; NSShadow *shadow = self.titleTextAttributes[NSShadowAttributeName]; @@ -1232,20 +1226,20 @@ @implementation UINavigationBar (LL_Hierarchy) shadow = nil; } - LLTitleCellModel *model11 = [self LL_noneInsetsCellModelWithTitle:@"Shadow" detailTitle:[self LL_hierarchyColorDescription:shadow.shadowColor]]; + LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:@"Shadow" detailTitle:[self LL_hierarchyColorDescription:shadow.shadowColor]] noneInsets]; [settings addObject:model11]; LLTitleCellModel *model12 = [[LLTitleCellModel alloc] initWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:shadow.shadowOffset]]; [settings addObject:model12]; if (@available(iOS 11.0, *)) { - LLTitleCellModel *model13 = [self LL_noneInsetsCellModelWithTitle:@"Large Title Attr." detailTitle:nil]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:@"Large Title Attr." detailTitle:nil] noneInsets]; [settings addObject:model13]; - LLTitleCellModel *model14 = [self LL_noneInsetsCellModelWithTitle:@"Title Font" detailTitle:[self LL_hierarchyColorDescription:self.largeTitleTextAttributes[NSFontAttributeName]]]; + LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:@"Title Font" detailTitle:[self LL_hierarchyColorDescription:self.largeTitleTextAttributes[NSFontAttributeName]]] noneInsets]; [settings addObject:model14]; - LLTitleCellModel *model15 = [self LL_noneInsetsCellModelWithTitle:@"Title Color" detailTitle:[self LL_hierarchyColorDescription:self.largeTitleTextAttributes[NSForegroundColorAttributeName]]]; + LLTitleCellModel *model15 = [[[LLTitleCellModel alloc] initWithTitle:@"Title Color" detailTitle:[self LL_hierarchyColorDescription:self.largeTitleTextAttributes[NSForegroundColorAttributeName]]] noneInsets]; [settings addObject:model15]; shadow = self.largeTitleTextAttributes[NSShadowAttributeName]; @@ -1253,7 +1247,7 @@ @implementation UINavigationBar (LL_Hierarchy) shadow = nil; } - LLTitleCellModel *model16 = [self LL_noneInsetsCellModelWithTitle:@"Shadow" detailTitle:[self LL_hierarchyColorDescription:shadow.shadowColor]]; + LLTitleCellModel *model16 = [[[LLTitleCellModel alloc] initWithTitle:@"Shadow" detailTitle:[self LL_hierarchyColorDescription:shadow.shadowColor]] noneInsets]; [settings addObject:model16]; LLTitleCellModel *model17 = [[LLTitleCellModel alloc] initWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:shadow.shadowOffset]]; @@ -1278,10 +1272,10 @@ @implementation UIToolbar (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Style" detailTitle:[LLEnumDescription barStyleDescription:self.barStyle]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription barStyleDescription:self.barStyle]] noneInsets]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]]]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]]] noneInsets]; [settings addObject:model2]; LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Bar Tint" detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; @@ -1305,28 +1299,28 @@ @implementation UITabBar (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Background" detailTitle:[self LL_hierarchyImageDescription:self.backgroundImage]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Background" detailTitle:[self LL_hierarchyImageDescription:self.backgroundImage]] noneInsets]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Shadow" detailTitle:[self LL_hierarchyImageDescription:self.shadowImage]]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Shadow" detailTitle:[self LL_hierarchyImageDescription:self.shadowImage]] noneInsets]; [settings addObject:model2]; LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Selection" detailTitle:[self LL_hierarchyImageDescription:self.selectionIndicatorImage]]; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:@"Style" detailTitle:[LLEnumDescription barStyleDescription:self.barStyle]]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription barStyleDescription:self.barStyle]] noneInsets]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]]]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]]] noneInsets]; [settings addObject:model5]; LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Bar Tint" detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; [settings addObject:model6]; - LLTitleCellModel *model7 = [self LL_noneInsetsCellModelWithTitle:@"Style" detailTitle:[LLEnumDescription tabBarItemPositioningDescription:self.itemPositioning]]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription tabBarItemPositioningDescription:self.itemPositioning]] noneInsets]; [settings addObject:model7]; - LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:@"Item Width" detailTitle:[LLFormatterTool formatNumber:@(self.itemWidth)]]; + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Item Width" detailTitle:[LLFormatterTool formatNumber:@(self.itemWidth)]] noneInsets]; [settings addObject:model8]; LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Item Spacing" detailTitle:[LLFormatterTool formatNumber:@(self.itemSpacing)]]; @@ -1350,46 +1344,46 @@ @implementation UISearchBar (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:@"Text" detailTitle:[self LL_hierarchyTextDescription:self.text]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Text" detailTitle:[self LL_hierarchyTextDescription:self.text]] noneInsets]; [settings addObject:model1]; - LLTitleCellModel *model2 = [self LL_noneInsetsCellModelWithTitle:@"Placeholder" detailTitle:[self LL_hierarchyTextDescription:self.placeholder]]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Placeholder" detailTitle:[self LL_hierarchyTextDescription:self.placeholder]] noneInsets]; [settings addObject:model2]; LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Prompt" detailTitle:[self LL_hierarchyTextDescription:self.prompt]]; [settings addObject:model3]; - LLTitleCellModel *model4 = [self LL_noneInsetsCellModelWithTitle:@"Search Style" detailTitle:[LLEnumDescription searchBarStyleDescription:self.searchBarStyle]]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Search Style" detailTitle:[LLEnumDescription searchBarStyleDescription:self.searchBarStyle]] noneInsets]; [settings addObject:model4]; - LLTitleCellModel *model5 = [self LL_noneInsetsCellModelWithTitle:@"Bar Style" detailTitle:[LLEnumDescription barStyleDescription:self.barStyle]]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Bar Style" detailTitle:[LLEnumDescription barStyleDescription:self.barStyle]] noneInsets]; [settings addObject:model5]; - LLTitleCellModel *model6 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]]]; + LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]]] noneInsets]; [settings addObject:model6]; LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; [settings addObject:model7]; - LLTitleCellModel *model8 = [self LL_noneInsetsCellModelWithTitle:@"Background" detailTitle:[self LL_hierarchyImageDescription:self.backgroundImage]]; + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Background" detailTitle:[self LL_hierarchyImageDescription:self.backgroundImage]] noneInsets]; [settings addObject:model8]; LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Scope Bar" detailTitle:[self LL_hierarchyImageDescription:self.scopeBarBackgroundImage]]; [settings addObject:model9]; - LLTitleCellModel *model10 = [self LL_noneInsetsCellModelWithTitle:@"Text Offset" detailTitle:[self LL_hierarchyOffsetDescription:self.searchTextPositionAdjustment]]; + LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Text Offset" detailTitle:[self LL_hierarchyOffsetDescription:self.searchTextPositionAdjustment]] noneInsets]; [settings addObject:model10]; LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:@"BG Offset" detailTitle:[self LL_hierarchyOffsetDescription:self.searchFieldBackgroundPositionAdjustment]]; [settings addObject:model11]; - LLTitleCellModel *model12 = [self LL_noneInsetsCellModelWithTitle:@"Options" detailTitle:[NSString stringWithFormat:@"Shows Search Results Button %@",[self LL_hierarchyBoolDescription:self.showsSearchResultsButton]]]; + LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Options" detailTitle:[NSString stringWithFormat:@"Shows Search Results Button %@",[self LL_hierarchyBoolDescription:self.showsSearchResultsButton]]] noneInsets]; [settings addObject:model12]; - LLTitleCellModel *model13 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Bookmarks Button %@",[self LL_hierarchyBoolDescription:self.showsBookmarkButton]]]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Bookmarks Button %@",[self LL_hierarchyBoolDescription:self.showsBookmarkButton]]] noneInsets]; [settings addObject:model13]; - LLTitleCellModel *model14 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Cancel Button %@",[self LL_hierarchyBoolDescription:self.showsCancelButton]]]; + LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Cancel Button %@",[self LL_hierarchyBoolDescription:self.showsCancelButton]]] noneInsets]; [settings addObject:model14]; LLTitleCellModel *model15 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Scope Bar %@",[self LL_hierarchyBoolDescription:self.showsScopeBar]]]; @@ -1398,10 +1392,10 @@ @implementation UISearchBar (LL_Hierarchy) LLTitleCellModel *model16 = [[LLTitleCellModel alloc] initWithTitle:@"Scope Titles" detailTitle:[self LL_hierarchyObjectDescription:self.scopeButtonTitles]]; [settings addObject:model16]; - LLTitleCellModel *model17 = [self LL_noneInsetsCellModelWithTitle:@"Capitalization" detailTitle:[LLEnumDescription textAutocapitalizationTypeDescription:self.autocapitalizationType]]; + LLTitleCellModel *model17 = [[[LLTitleCellModel alloc] initWithTitle:@"Capitalization" detailTitle:[LLEnumDescription textAutocapitalizationTypeDescription:self.autocapitalizationType]] noneInsets]; [settings addObject:model17]; - LLTitleCellModel *model18 = [self LL_noneInsetsCellModelWithTitle:@"Correction" detailTitle:[LLEnumDescription textAutocorrectionTypeDescription:self.autocorrectionType]]; + LLTitleCellModel *model18 = [[[LLTitleCellModel alloc] initWithTitle:@"Correction" detailTitle:[LLEnumDescription textAutocorrectionTypeDescription:self.autocorrectionType]] noneInsets]; [settings addObject:model18]; LLTitleCellModel *model19 = [[LLTitleCellModel alloc] initWithTitle:@"Keyboard" detailTitle:[LLEnumDescription keyboardTypeDescription:self.keyboardType]]; @@ -1425,7 +1419,7 @@ @implementation UIWindow (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [self LL_noneInsetsCellModelWithTitle:nil detailTitle:[NSString stringWithFormat:@"Key Window %@",[self LL_hierarchyBoolDescription:self.isKeyWindow]]]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Key Window %@",[self LL_hierarchyBoolDescription:self.isKeyWindow]]] noneInsets]; [settings addObject:model1]; LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Root Controller" detailTitle:[self LL_hierarchyObjectDescription:self.rootViewController]]; From 24a79322b4353863bf6f3295647cad033b494bc8 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Fri, 25 Oct 2019 17:52:43 +0800 Subject: [PATCH 08/45] Dynamic change view properties. --- .../Function/NSObject+LL_Hierarchy.m | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index dea8581d..11a5a464 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -169,10 +169,19 @@ @implementation UIView (LL_Hierarchy) }; [settings addObject:model5]; - LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Multiple Touch %@", [self LL_hierarchyBoolDescription:self.isMultipleTouchEnabled]]]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Multiple Touch" flag:self.isMultipleTouchEnabled]; + model6.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.multipleTouchEnabled = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model6]; LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Alpha" detailTitle:[LLFormatterTool formatNumber:@(self.alpha)]] noneInsets]; + model7.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(self.alpha)] handler:^(NSString * _Nullable newText) { + weakSelf.alpha = [[LLFormatterTool formatNumber:@([newText doubleValue])] doubleValue]; + }]; + }; [settings addObject:model7]; LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Background" detailTitle:[self LL_hierarchyColorDescription:self.backgroundColor]] noneInsets]; @@ -181,19 +190,39 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Tint" detailTitle:[self LL_hierarchyColorDescription:self.tintColor]]; [settings addObject:model9]; - LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Drawing" detailTitle:[NSString stringWithFormat:@"Opaque %@",[self LL_hierarchyBoolDescription:self.isOpaque]]] noneInsets]; + LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Opaque" flag:self.isOpaque] noneInsets]; + model10.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.opaque = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model10]; - LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Hidden %@",[self LL_hierarchyBoolDescription:self.isHidden]]] noneInsets]; + LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:@"Hidden" flag:self.isHidden] noneInsets]; + model11.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.hidden = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model11]; - LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clears Graphics Context %@",[self LL_hierarchyBoolDescription:self.clearsContextBeforeDrawing]]] noneInsets]; + LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Clears Graphics Context" flag:self.clearsContextBeforeDrawing] noneInsets]; + model12.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.clearsContextBeforeDrawing = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model12]; - LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clip To Bounds %@",[self LL_hierarchyBoolDescription:self.clipsToBounds]]] noneInsets]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:@"Clip To Bounds" flag:self.clipsToBounds] noneInsets]; + model13.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.clipsToBounds = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model13]; - LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Autoresizes Subviews %@", [self LL_hierarchyBoolDescription:self.autoresizesSubviews]]]; + LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:@"Autoresizes Subviews" flag:self.autoresizesSubviews]; + model14.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.autoresizesSubviews = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model14]; LLTitleCellModel *model15 = [[[LLTitleCellModel alloc] initWithTitle:@"Trait Collection" detailTitle:nil] noneInsets]; From 3e7768dc47bf0c6d64d072e7c143e43237af76ef Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Fri, 25 Oct 2019 18:33:55 +0800 Subject: [PATCH 09/45] Dynamic UILabel attributes. --- .../Function/NSObject+LL_Hierarchy.m | 69 ++++++++++++++++++- .../EnumDescription/LLEnumDescription.h | 6 ++ .../EnumDescription/LLEnumDescription.m | 33 +++++++++ 3 files changed, 105 insertions(+), 3 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 11a5a464..7c73f22f 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -179,7 +179,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Alpha" detailTitle:[LLFormatterTool formatNumber:@(self.alpha)]] noneInsets]; model7.block = ^{ [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(self.alpha)] handler:^(NSString * _Nullable newText) { - weakSelf.alpha = [[LLFormatterTool formatNumber:@([newText doubleValue])] doubleValue]; + weakSelf.alpha = [newText doubleValue]; }]; }; [settings addObject:model7]; @@ -260,9 +260,21 @@ @implementation UIView (LL_Hierarchy) @implementation UILabel (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self) weakSelf = self; NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Text" detailTitle:[self LL_hierarchyTextDescription:self.text]] noneInsets]; + model1.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.text handler:^(NSString * _Nullable newText) { + if (weakSelf.attributedText == nil) { + weakSelf.text = newText; + } else { + NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] initWithAttributedString:weakSelf.attributedText]; + [attribute replaceCharactersInRange:NSMakeRange(0, weakSelf.attributedText.length) withString:newText]; + weakSelf.attributedText = attribute; + } + }]; + }; [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:self.attributedText == nil ? @"Plain Text" : @"Attributed Text"] noneInsets]; @@ -272,27 +284,65 @@ @implementation UILabel (LL_Hierarchy) [settings addObject:model3]; LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyObjectDescription:self.font]] noneInsets]; + model4.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(weakSelf.font.pointSize)]] handler:^(NSString * _Nullable newText) { + weakSelf.font = [weakSelf.font fontWithSize:[newText doubleValue]]; + }]; + }; [settings addObject:model4]; LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Aligned %@", [LLEnumDescription textAlignmentDescription:self.textAlignment]]] noneInsets]; + model5.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription textAlignments] currentAction:[LLEnumDescription textAlignmentDescription:weakSelf.textAlignment] completion:^(NSInteger index) { + weakSelf.textAlignment = index; + }]; + }; [settings addObject:model5]; LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Lines" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.numberOfLines]] noneInsets]; + model6.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.numberOfLines] handler:^(NSString * _Nullable newText) { + weakSelf.numberOfLines = [newText integerValue]; + }]; + }; [settings addObject:model6]; - LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Enabled %@",[self LL_hierarchyBoolDescription:self.isEnabled]]] noneInsets]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Enabled" flag:self.isEnabled] noneInsets]; + model7.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.enabled = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model7]; - LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Highlighted %@", [self LL_hierarchyBoolDescription:self.isHighlighted]]]; + LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:@"Highlighted" flag:self.isHighlighted]; + model8.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.highlighted = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model8]; LLTitleCellModel *model9 = [[[LLTitleCellModel alloc] initWithTitle:@"Baseline" detailTitle:[NSString stringWithFormat:@"Align %@",[LLEnumDescription baselineAdjustmentDescription:self.baselineAdjustment]]] noneInsets]; + model9.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription baselineAdjustments] currentAction:[LLEnumDescription baselineAdjustmentDescription:weakSelf.baselineAdjustment] completion:^(NSInteger index) { + weakSelf.baselineAdjustment = index; + }]; + }; [settings addObject:model9]; LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Line Break" detailTitle:[LLEnumDescription lineBreakModeDescription:self.lineBreakMode]] noneInsets]; + model10.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription lineBreaks] currentAction:[LLEnumDescription lineBreakModeDescription:weakSelf.lineBreakMode] completion:^(NSInteger index) { + weakSelf.lineBreakMode = index; + }]; + }; [settings addObject:model10]; LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:@"Min Font Scale" detailTitle:[LLFormatterTool formatNumber:@(self.minimumScaleFactor)]]; + model11.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.minimumScaleFactor)] handler:^(NSString * _Nullable newText) { + weakSelf.minimumScaleFactor = [newText doubleValue]; + }]; + }; [settings addObject:model11]; LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Highlighted" detailTitle:[self LL_hierarchyColorDescription:self.highlightedTextColor]] noneInsets]; @@ -302,6 +352,19 @@ @implementation UILabel (LL_Hierarchy) [settings addObject:model13]; LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:self.shadowOffset]]; + model14.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromCGSize(weakSelf.shadowOffset) handler:^(NSString * _Nullable newText) { + CGSize newSize = CGSizeFromString(newText); + if (CGSizeEqualToSize(newSize, CGSizeZero)) { + if (![newText isEqualToString:NSStringFromCGSize(CGSizeZero)]) { + // Wrong text. + [LLTool log:@"Input a wrong size string."]; + return; + } + } + weakSelf.shadowOffset = newSize; + }]; + }; [settings addObject:model14]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Label" items:settings]; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h index 5de2cfad..4e217368 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h @@ -30,6 +30,8 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *_Nullable)lineBreakModeDescription:(NSLineBreakMode)mode; ++ (NSArray *)lineBreaks; + + (NSString *_Nullable)userInterfaceStyleDescription:(UIUserInterfaceStyle)style API_AVAILABLE(ios(12.0)); + (NSString *_Nullable)userInterfaceSizeClassDescription:(UIUserInterfaceSizeClass)sizeClass; @@ -42,8 +44,12 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *_Nullable)textAlignmentDescription:(NSTextAlignment)textAlignment; ++ (NSArray *)textAlignments; + + (NSString *_Nullable)baselineAdjustmentDescription:(UIBaselineAdjustment)baselineAdjustment; ++ (NSArray *)baselineAdjustments; + + (NSString *_Nullable)controlContentVerticalAlignmentDescription:(UIControlContentVerticalAlignment)contentVerticalAlignment; + (NSString *_Nullable)controlContentHorizontalAlignmentDescription:(UIControlContentHorizontalAlignment)contentHorizontalAlignment; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m index 220f3c69..639f27a7 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m @@ -42,6 +42,17 @@ + (NSString *)lineBreakModeDescription:(NSLineBreakMode)mode { return nil; } ++ (NSArray *)lineBreaks { + NSMutableArray *breaks = [[NSMutableArray alloc] init]; + for (NSLineBreakMode i = NSLineBreakByWordWrapping; i <= NSLineBreakByTruncatingMiddle; i++) { + NSString *lineBreak = [self lineBreakModeDescription:i]; + if (lineBreak) { + [breaks addObject:lineBreak]; + } + } + return [breaks copy]; +} + + (NSString *_Nullable)userInterfaceStyleDescription:(UIUserInterfaceStyle)style { switch (style) { case UIUserInterfaceStyleUnspecified: @@ -137,6 +148,17 @@ + (NSString *)textAlignmentDescription:(NSTextAlignment)textAlignment { return nil; } ++ (NSArray *)textAlignments { + NSMutableArray *alignments = [[NSMutableArray alloc] init]; + for (NSTextAlignment i = NSTextAlignmentLeft; i <= NSTextAlignmentNatural; i++) { + NSString *alignment = [self textAlignmentDescription:i]; + if (alignment) { + [alignments addObject:alignment]; + } + } + return [alignments copy]; +} + + (NSString *)baselineAdjustmentDescription:(UIBaselineAdjustment)baselineAdjustment { switch (baselineAdjustment) { case UIBaselineAdjustmentAlignBaselines: @@ -149,6 +171,17 @@ + (NSString *)baselineAdjustmentDescription:(UIBaselineAdjustment)baselineAdjust return nil; } ++ (NSArray *)baselineAdjustments { + NSMutableArray *adjustments = [[NSMutableArray alloc] init]; + for (UIBaselineAdjustment i = UIBaselineAdjustmentAlignBaselines; i <= UIBaselineAdjustmentNone; i++) { + NSString *adjustment = [self baselineAdjustmentDescription:i]; + if (adjustment) { + [adjustments addObject:adjustment]; + } + } + return adjustments; +} + + (NSString *)controlContentVerticalAlignmentDescription:(UIControlContentVerticalAlignment)contentVerticalAlignment { switch (contentVerticalAlignment) { case UIControlContentVerticalAlignmentCenter: From 8169d8035090aeff5cb424d0855f9c66adc478ee Mon Sep 17 00:00:00 2001 From: HDB-Li Date: Sat, 26 Oct 2019 22:01:56 +0800 Subject: [PATCH 10/45] Dynamic UIControl part. --- .../Function/NSObject+LL_Hierarchy.m | 30 +++++++++++++++++-- .../EnumDescription/LLEnumDescription.h | 4 +++ .../EnumDescription/LLEnumDescription.m | 26 ++++++++++++++++ 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 7c73f22f..31f7f50c 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -383,21 +383,45 @@ @implementation UILabel (LL_Hierarchy) @implementation UIControl (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self) weakSelf = self; + NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Alignment" detailTitle:[NSString stringWithFormat:@"%@ Horizonally", [LLEnumDescription controlContentHorizontalAlignmentDescription:self.contentHorizontalAlignment]]] noneInsets]; + model1.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription controlContentHorizontalAlignments] currentAction:[LLEnumDescription controlContentHorizontalAlignmentDescription:weakSelf.contentHorizontalAlignment] completion:^(NSInteger index) { + weakSelf.contentHorizontalAlignment = index; + }]; + }; [settings addObject:model1]; LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"%@ Vertically", [LLEnumDescription controlContentVerticalAlignmentDescription:self.contentVerticalAlignment]]]; + model2.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription controlContentVerticalAlignments] currentAction:[LLEnumDescription controlContentVerticalAlignmentDescription:weakSelf.contentVerticalAlignment] completion:^(NSInteger index) { + weakSelf.contentVerticalAlignment = index; + }]; + }; [settings addObject:model2]; - LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Content" detailTitle:self.isSelected ? @"Selected" : @"Not Selected"] noneInsets]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Select" flag:self.isSelected] noneInsets]; + model3.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.selected = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model3]; - LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:self.isEnabled ? @"Enabled" : @"Not Enabled"] noneInsets]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Enable" flag:self.isEnabled] noneInsets]; + model4.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.enabled = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model4]; - LLTitleCellModel *model5 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:self.isHighlighted ? @"Highlighted" : @"Not Highlighted"]; + LLTitleCellModel *model5 = [[LLTitleCellModel alloc] initWithTitle:@"Highlight" flag:self.isHighlighted]; + model5.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.highlighted = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model5]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Control" items:settings]; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h index 4e217368..ba66df6d 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h @@ -52,8 +52,12 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *_Nullable)controlContentVerticalAlignmentDescription:(UIControlContentVerticalAlignment)contentVerticalAlignment; ++ (NSArray *)controlContentVerticalAlignments; + + (NSString *_Nullable)controlContentHorizontalAlignmentDescription:(UIControlContentHorizontalAlignment)contentHorizontalAlignment; ++ (NSArray *)controlContentHorizontalAlignments; + + (NSString *_Nullable)buttonTypeDescription:(UIButtonType)buttonType; + (NSString *_Nullable)controlStateDescription:(UIControlState)state; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m index 639f27a7..b8b9d9cd 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m @@ -196,6 +196,17 @@ + (NSString *)controlContentVerticalAlignmentDescription:(UIControlContentVertic return nil; } ++ (NSArray *)controlContentVerticalAlignments { + NSMutableArray *alignments = [[NSMutableArray alloc] init]; + for (UIControlContentVerticalAlignment i = UIControlContentVerticalAlignmentCenter; i <= UIControlContentVerticalAlignmentFill; i++) { + NSString *alignment = [self controlContentVerticalAlignmentDescription:i]; + if (alignment) { + [alignments addObject:alignment]; + } + } + return [alignments copy]; +} + + (NSString *)controlContentHorizontalAlignmentDescription:(UIControlContentHorizontalAlignment)contentHorizontalAlignment { switch (contentHorizontalAlignment) { case UIControlContentHorizontalAlignmentCenter: @@ -214,6 +225,21 @@ + (NSString *)controlContentHorizontalAlignmentDescription:(UIControlContentHori return nil; } ++ (NSArray *)controlContentHorizontalAlignments { + NSMutableArray *alignments = [[NSMutableArray alloc] init]; + UIControlContentHorizontalAlignment max = UIControlContentHorizontalAlignmentFill; + if (@available(iOS 11.0, *)) { + max = UIControlContentHorizontalAlignmentTrailing; + } + for (UIControlContentHorizontalAlignment i = UIControlContentHorizontalAlignmentCenter; i <= max; i++) { + NSString *alignment = [self controlContentHorizontalAlignmentDescription:i]; + if (alignment) { + [alignments addObject:alignment]; + } + } + return [alignments copy]; +} + + (NSString *)buttonTypeDescription:(UIButtonType)buttonType { switch (buttonType) { case UIButtonTypeCustom: From a1e15af17a32cc3a8ce6485f9e4cbd38a9e93f89 Mon Sep 17 00:00:00 2001 From: HDB-Li Date: Sat, 26 Oct 2019 22:16:48 +0800 Subject: [PATCH 11/45] Dynamic UIButton part. --- .../Function/NSObject+LL_Hierarchy.m | 50 +++++++++++++++---- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 31f7f50c..d5626b35 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -96,10 +96,30 @@ - (NSString *)LL_hierarchySizeDescription:(CGSize)size { return [NSString stringWithFormat:@"w %@ h %@",[LLFormatterTool formatNumber:@(size.width)], [LLFormatterTool formatNumber:@(size.height)]]; } +- (CGSize)LL_sizeFromString:(NSString *)string originalSize:(CGSize)size { + CGSize newSize = CGSizeFromString(string); + if (CGSizeEqualToSize(newSize, CGSizeZero) && ![string isEqualToString:NSStringFromCGSize(CGSizeZero)]) { + // Wrong text. + [LLTool log:@"Input a wrong size string."]; + return size; + } + return newSize; +} + - (NSString *)LL_hierarchyInsetsTopBottomDescription:(UIEdgeInsets)insets { return [NSString stringWithFormat:@"top %@ bottom %@",[LLFormatterTool formatNumber:@(insets.top)], [LLFormatterTool formatNumber:@(insets.bottom)]]; } +- (UIEdgeInsets)LL_insetsFromString:(NSString *)string originalInsets:(UIEdgeInsets)insets { + UIEdgeInsets newInsets = UIEdgeInsetsFromString(string); + if (UIEdgeInsetsEqualToEdgeInsets(newInsets, UIEdgeInsetsZero) && ![string isEqualToString:NSStringFromUIEdgeInsets(UIEdgeInsetsZero)]) { + // Wrong text. + [LLTool log:@"Input a wrong insets string."]; + return insets; + } + return newInsets; +} + - (NSString *)LL_hierarchyInsetsLeftRightDescription:(UIEdgeInsets)insets { return [NSString stringWithFormat:@"left %@ right %@",[LLFormatterTool formatNumber:@(insets.left)], [LLFormatterTool formatNumber:@(insets.right)]]; } @@ -354,15 +374,7 @@ @implementation UILabel (LL_Hierarchy) LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:self.shadowOffset]]; model14.block = ^{ [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromCGSize(weakSelf.shadowOffset) handler:^(NSString * _Nullable newText) { - CGSize newSize = CGSizeFromString(newText); - if (CGSizeEqualToSize(newSize, CGSizeZero)) { - if (![newText isEqualToString:NSStringFromCGSize(CGSizeZero)]) { - // Wrong text. - [LLTool log:@"Input a wrong size string."]; - return; - } - } - weakSelf.shadowOffset = newSize; + weakSelf.shadowOffset = [weakSelf LL_sizeFromString:newText originalSize:weakSelf.shadowOffset]; }]; }; [settings addObject:model14]; @@ -481,6 +493,11 @@ @implementation UIButton (LL_Hierarchy) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:self.titleShadowOffset]] noneInsets]; + model10.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromCGSize(weakSelf.titleShadowOffset) handler:^(NSString * _Nullable newText) { + weakSelf.titleShadowOffset = [self LL_sizeFromString:newText originalSize:weakSelf.titleShadowOffset]; + }]; + }; [settings addObject:model10]; #pragma clang diagnostic pop @@ -503,18 +520,33 @@ @implementation UIButton (LL_Hierarchy) #pragma clang diagnostic pop LLTitleCellModel *model16 = [[[LLTitleCellModel alloc] initWithTitle:@"Content Insets" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.contentEdgeInsets]] noneInsets]; + model16.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromUIEdgeInsets(weakSelf.contentEdgeInsets) handler:^(NSString * _Nullable newText) { + weakSelf.contentEdgeInsets = [weakSelf LL_insetsFromString:newText originalInsets:weakSelf.contentEdgeInsets]; + }]; + }; [settings addObject:model16]; LLTitleCellModel *model17 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.contentEdgeInsets]] noneInsets]; [settings addObject:model17]; LLTitleCellModel *model18 = [[[LLTitleCellModel alloc] initWithTitle:@"Title Insets" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.titleEdgeInsets]] noneInsets]; + model18.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromUIEdgeInsets(weakSelf.titleEdgeInsets) handler:^(NSString * _Nullable newText) { + weakSelf.titleEdgeInsets = [weakSelf LL_insetsFromString:newText originalInsets:weakSelf.titleEdgeInsets]; + }]; + }; [settings addObject:model18]; LLTitleCellModel *model19 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.titleEdgeInsets]] noneInsets]; [settings addObject:model19]; LLTitleCellModel *model20 = [[[LLTitleCellModel alloc] initWithTitle:@"Image Insets" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.imageEdgeInsets]] noneInsets]; + model20.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromUIEdgeInsets(weakSelf.imageEdgeInsets) handler:^(NSString * _Nullable newText) { + weakSelf.imageEdgeInsets = [weakSelf LL_insetsFromString:newText originalInsets:weakSelf.imageEdgeInsets]; + }]; + }; [settings addObject:model20]; LLTitleCellModel *model21 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.imageEdgeInsets]]; From 60c94f82101bca6509c539a0f9888c361afd8a98 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Mon, 28 Oct 2019 10:24:58 +0800 Subject: [PATCH 12/45] Dynamic UIImageView part. --- .../Component/Hierarchy/Function/NSObject+LL_Hierarchy.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index d5626b35..df36ab96 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -568,6 +568,8 @@ @implementation UIButton (LL_Hierarchy) @implementation UIImageView (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self)weakSelf = self; + NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[LLTitleCellModel alloc] initWithTitle:@"Image" detailTitle: [self LL_hierarchyImageDescription:self.image]]; @@ -576,7 +578,11 @@ @implementation UIImageView (LL_Hierarchy) LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Highlighted" detailTitle: [self LL_hierarchyImageDescription:self.highlightedImage]]; [settings addObject:model2]; - LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"State" detailTitle:self.isHighlighted ? @"Highlighted" : @"Not Highlighted"]; + LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Highlight" flag:self.isHighlighted]; + model3.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.highlighted = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model3]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Image View" items:settings]; From dee10ce5a80aaae30568128b9b30c4fc3fe46464 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Mon, 28 Oct 2019 11:30:59 +0800 Subject: [PATCH 13/45] Dynamic UITextField part. --- .../Function/NSObject+LL_Hierarchy.m | 104 +++++++++++++++++- .../EnumDescription/LLEnumDescription.h | 14 +++ .../EnumDescription/LLEnumDescription.m | 93 +++++++++++++++- 3 files changed, 201 insertions(+), 10 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index df36ab96..3e5e8955 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -150,6 +150,17 @@ - (void)LL_postHierarchyChangeNotification { [[NSNotificationCenter defaultCenter] postNotificationName:LLHierarchyChangeNotificationName object:self]; } +- (void)LL_replaceAttributeString:(NSString *)newString key:(NSString *)key { + NSAttributedString *string = [self valueForKey:key]; + if (string && ![string isKindOfClass:[NSAttributedString class]]) { + [LLTool log:[NSString stringWithFormat:@"KeyPath:%@ isn't a NSAttributedString or nil", key]]; + return; + } + NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] initWithAttributedString:string]; + [attribute replaceCharactersInRange:NSMakeRange(0, string.length) withString:newString]; + [self setValue:string forKey:key]; +} + @end @implementation UIView (LL_Hierarchy) @@ -289,9 +300,7 @@ @implementation UILabel (LL_Hierarchy) if (weakSelf.attributedText == nil) { weakSelf.text = newText; } else { - NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] initWithAttributedString:weakSelf.attributedText]; - [attribute replaceCharactersInRange:NSMakeRange(0, weakSelf.attributedText.length) withString:newText]; - weakSelf.attributedText = attribute; + [weakSelf LL_replaceAttributeString:newText key:@"attributedText"]; } }]; }; @@ -601,12 +610,24 @@ @implementation UIImageView (LL_Hierarchy) @implementation UITextField (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self) weakSelf = self; + NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Plain Text" detailTitle:[self LL_hierarchyTextDescription:self.text]] noneInsets]; + model1.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.text handler:^(NSString * _Nullable newText) { + weakSelf.text = newText; + }]; + }; [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Attributed Text" detailTitle:[self LL_hierarchyObjectDescription:self.attributedText]] noneInsets]; + model2.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.attributedText.string handler:^(NSString * _Nullable newText) { + [weakSelf LL_replaceAttributeString:newText key:@"attributedText"]; + }]; + }; [settings addObject:model2]; LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Allows Editing Attributes %@", [self LL_hierarchyBoolDescription:self.allowsEditingTextAttributes]]] noneInsets]; @@ -616,12 +637,31 @@ @implementation UITextField (LL_Hierarchy) [settings addObject:model4]; LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Font" detailTitle:[self LL_hierarchyObjectDescription:self.font]] noneInsets]; + model5.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(weakSelf.font.pointSize)]] handler:^(NSString * _Nullable newText) { + weakSelf.font = [weakSelf.font fontWithSize:[newText doubleValue]]; + }]; + }; [settings addObject:model5]; LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Alignment" detailTitle:[LLEnumDescription textAlignmentDescription:self.textAlignment]] noneInsets]; + model6.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription textAlignments] currentAction:[LLEnumDescription textAlignmentDescription:weakSelf.textAlignment] completion:^(NSInteger index) { + weakSelf.textAlignment = index; + }]; + }; [settings addObject:model6]; LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:@"Placeholder" detailTitle:[self LL_hierarchyTextDescription:self.placeholder ?: self.attributedPlaceholder.string]]; + model7.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:(weakSelf.placeholder ?: weakSelf.attributedPlaceholder.string) handler:^(NSString * _Nullable newText) { + if (weakSelf.placeholder) { + weakSelf.placeholder = newText; + } else { + [weakSelf LL_replaceAttributeString:newText key:@"attributedPlaceholder"]; + } + }]; + }; [settings addObject:model7]; LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Background" detailTitle: [self LL_hierarchyImageDescription:self.background]] noneInsets]; @@ -631,39 +671,91 @@ @implementation UITextField (LL_Hierarchy) [settings addObject:model9]; LLTitleCellModel *model10 = [[LLTitleCellModel alloc] initWithTitle:@"Border Style" detailTitle:[LLEnumDescription textBorderStyleDescription:self.borderStyle]]; + model10.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription textBorderStyles] currentAction:[LLEnumDescription textBorderStyleDescription:weakSelf.borderStyle] completion:^(NSInteger index) { + weakSelf.borderStyle = index; + }]; + }; [settings addObject:model10]; LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:@"Clear Button" detailTitle:[LLEnumDescription textFieldViewModeDescription:self.clearButtonMode]] noneInsets]; + model11.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription textFieldViewModes] currentAction:[LLEnumDescription textFieldViewModeDescription:weakSelf.clearButtonMode] completion:^(NSInteger index) { + weakSelf.clearButtonMode = index; + }]; + }; [settings addObject:model11]; - LLTitleCellModel *model12 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clear when editing begins %@", [self LL_hierarchyBoolDescription:self.clearsOnBeginEditing]]]; + LLTitleCellModel *model12 = [[LLTitleCellModel alloc] initWithTitle:@"Clear on edit" flag:self.clearsOnBeginEditing]; + model12.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.clearsOnBeginEditing = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model12]; LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Font Size" detailTitle:[LLFormatterTool formatNumber:@(self.minimumFontSize)]] noneInsets]; + model13.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.minimumFontSize)] handler:^(NSString * _Nullable newText) { + weakSelf.minimumFontSize = [newText doubleValue]; + }]; + }; [settings addObject:model13]; - LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Adjusts to Fit %@",[self LL_hierarchyBoolDescription:self.adjustsFontSizeToFitWidth]]]; + LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:@"Adjust font size" flag:self.adjustsFontSizeToFitWidth]; + model14.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.adjustsFontSizeToFitWidth = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model14]; LLTitleCellModel *model15 = [[[LLTitleCellModel alloc] initWithTitle:@"Capitalization" detailTitle:[LLEnumDescription textAutocapitalizationTypeDescription:self.autocapitalizationType]] noneInsets]; + model15.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription textAutocapitalizationTypes] currentAction:[LLEnumDescription textAutocapitalizationTypeDescription:weakSelf.autocapitalizationType] completion:^(NSInteger index) { + weakSelf.autocapitalizationType = index; + }]; + }; [settings addObject:model15]; LLTitleCellModel *model16 = [[[LLTitleCellModel alloc] initWithTitle:@"Correction" detailTitle:[LLEnumDescription textAutocorrectionTypeDescription:self.autocorrectionType]] noneInsets]; + model16.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription textAutocorrectionTypes] currentAction:[LLEnumDescription textAutocorrectionTypeDescription:weakSelf.autocorrectionType] completion:^(NSInteger index) { + weakSelf.autocorrectionType = index; + }]; + }; [settings addObject:model16]; LLTitleCellModel *model17 = [[[LLTitleCellModel alloc] initWithTitle:@"Keyboard" detailTitle:[LLEnumDescription keyboardTypeDescription:self.keyboardType]] noneInsets]; + model17.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription keyboardTypes] currentAction:[LLEnumDescription keyboardTypeDescription:weakSelf.keyboardType] completion:^(NSInteger index) { + weakSelf.keyboardType = index; + }]; + }; [settings addObject:model17]; LLTitleCellModel *model18 = [[[LLTitleCellModel alloc] initWithTitle:@"Appearance" detailTitle:[LLEnumDescription keyboardAppearanceDescription:self.keyboardAppearance]] noneInsets]; + model18.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription keyboardAppearances] currentAction:[LLEnumDescription keyboardAppearanceDescription:weakSelf.keyboardAppearance] completion:^(NSInteger index) { + weakSelf.keyboardAppearance = index; + }]; + }; [settings addObject:model18]; LLTitleCellModel *model19 = [[[LLTitleCellModel alloc] initWithTitle:@"Return Key" detailTitle:[LLEnumDescription returnKeyTypeDescription:self.returnKeyType]] noneInsets]; + model19.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription returnKeyTypes] currentAction:[LLEnumDescription returnKeyTypeDescription:weakSelf.returnKeyType] completion:^(NSInteger index) { + weakSelf.returnKeyType = index; + }]; + }; [settings addObject:model19]; LLTitleCellModel *model20 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Auto-enable Return Key %@", [self LL_hierarchyBoolDescription:self.enablesReturnKeyAutomatically]]] noneInsets]; [settings addObject:model20]; - LLTitleCellModel *model21 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Secure Entry %@",[self LL_hierarchyBoolDescription:self.secureTextEntry]]]; + LLTitleCellModel *model21 = [[LLTitleCellModel alloc] initWithTitle:@"Secure Entry" flag:self.isSecureTextEntry]; + model21.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.secureTextEntry = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model21]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Text Field" items:settings]; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h index ba66df6d..58164024 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h @@ -64,18 +64,32 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *_Nullable)textBorderStyleDescription:(UITextBorderStyle)style; ++ (NSArray *)textBorderStyles; + + (NSString *_Nullable)textFieldViewModeDescription:(UITextFieldViewMode)mode; ++ (NSArray *)textFieldViewModes; + + (NSString *_Nullable)textAutocapitalizationTypeDescription:(UITextAutocapitalizationType)type; ++ (NSArray *)textAutocapitalizationTypes; + + (NSString *_Nullable)textAutocorrectionTypeDescription:(UITextAutocorrectionType)type; ++ (NSArray *)textAutocorrectionTypes; + + (NSString *_Nullable)keyboardTypeDescription:(UIKeyboardType)type; ++ (NSArray *)keyboardTypes; + + (NSString *_Nullable)keyboardAppearanceDescription:(UIKeyboardAppearance)appearance; ++ (NSArray *)keyboardAppearances; + + (NSString *_Nullable)returnKeyTypeDescription:(UIReturnKeyType)type; ++ (NSArray *)returnKeyTypes; + + (NSString *_Nullable)activityIndicatorViewStyleDescription:(UIActivityIndicatorViewStyle)style; + (NSString *_Nullable)progressViewStyleDescription:(UIProgressViewStyle)style; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m index b8b9d9cd..e544d55b 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m @@ -298,6 +298,17 @@ + (NSString *)textBorderStyleDescription:(UITextBorderStyle)style { return nil; } ++ (NSArray *)textBorderStyles { + NSMutableArray *styles = [[NSMutableArray alloc] init]; + for (UITextBorderStyle i = UITextBorderStyleNone; i <= UITextBorderStyleRoundedRect; i++) { + NSString *style = [self textBorderStyleDescription:i]; + if (style) { + [styles addObject:style]; + } + } + return [styles copy]; +} + + (NSString *)textFieldViewModeDescription:(UITextFieldViewMode)mode { switch (mode) { case UITextFieldViewModeNever: @@ -312,7 +323,18 @@ + (NSString *)textFieldViewModeDescription:(UITextFieldViewMode)mode { return nil; } -+ (NSString *_Nullable)textAutocapitalizationTypeDescription:(UITextAutocapitalizationType)type { ++ (NSArray *)textFieldViewModes { + NSMutableArray *modes = [[NSMutableArray alloc] init]; + for (UITextFieldViewMode i = UITextFieldViewModeNever; i <= UITextFieldViewModeAlways; i++) { + NSString *mode = [self textFieldViewModeDescription:i]; + if (mode) { + [modes addObject:mode]; + } + } + return [modes copy]; +} + ++ (NSString *)textAutocapitalizationTypeDescription:(UITextAutocapitalizationType)type { switch (type) { case UITextAutocapitalizationTypeNone: return @"None"; @@ -326,19 +348,41 @@ + (NSString *_Nullable)textAutocapitalizationTypeDescription:(UITextAutocapitali return nil; } ++ (NSArray *)textAutocapitalizationTypes { + NSMutableArray *types = [[NSMutableArray alloc] init]; + for (UITextAutocapitalizationType i = UITextAutocapitalizationTypeNone; i <= UITextAutocapitalizationTypeAllCharacters; i++) { + NSString *type = [self textAutocapitalizationTypeDescription:i]; + if (type) { + [types addObject:type]; + } + } + return [types copy]; +} + + (NSString *)textAutocorrectionTypeDescription:(UITextAutocorrectionType)type { switch (type) { case UITextAutocorrectionTypeDefault: return @"Default"; - case UITextAutocorrectionTypeYes: - return @"YES"; case UITextAutocorrectionTypeNo: return @"NO"; + case UITextAutocorrectionTypeYes: + return @"YES"; } return nil; } -+ (NSString *_Nullable)keyboardTypeDescription:(UIKeyboardType)type { ++ (NSArray *)textAutocorrectionTypes { + NSMutableArray *types = [[NSMutableArray alloc] init]; + for (UITextAutocorrectionType i = 0; i <= UITextAutocorrectionTypeYes; i++) { + NSString *type = [self textAutocorrectionTypeDescription:i]; + if (type) { + [types addObject:type]; + } + } + return [types copy]; +} + ++ (NSString *)keyboardTypeDescription:(UIKeyboardType)type { switch (type) { case UIKeyboardTypeDefault: return @"Default"; @@ -368,6 +412,21 @@ + (NSString *_Nullable)keyboardTypeDescription:(UIKeyboardType)type { return nil; } ++ (NSArray *)keyboardTypes { + NSMutableArray *types = [[NSMutableArray alloc] init]; + UIKeyboardType max = UIKeyboardTypeWebSearch; + if (@available(iOS 10.0, *)) { + max = UIKeyboardTypeASCIICapableNumberPad; + } + for (UIKeyboardType i = UIKeyboardTypeDefault; i <= max; i++) { + NSString *type = [self keyboardTypeDescription:i]; + if (type) { + [types addObject:type]; + } + } + return [types copy]; +} + + (NSString *)keyboardAppearanceDescription:(UIKeyboardAppearance)appearance { switch (appearance) { case UIKeyboardAppearanceDefault: @@ -380,6 +439,17 @@ + (NSString *)keyboardAppearanceDescription:(UIKeyboardAppearance)appearance { return nil; } ++ (NSArray *)keyboardAppearances { + NSMutableArray *appearances = [[NSMutableArray alloc] init]; + for (UIKeyboardAppearance i = UIKeyboardAppearanceDefault; i <= UIKeyboardAppearanceLight; i++) { + NSString *appearance = [self keyboardAppearanceDescription:i]; + if (appearance) { + [appearances addObject:appearance]; + } + } + return [appearances copy]; +} + + (NSString *)returnKeyTypeDescription:(UIReturnKeyType)type { switch (type) { case UIReturnKeyDefault: @@ -410,6 +480,21 @@ + (NSString *)returnKeyTypeDescription:(UIReturnKeyType)type { return nil; } ++ (NSArray *)returnKeyTypes { + NSMutableArray *types = [[NSMutableArray alloc] init]; + UIReturnKeyType max = UIReturnKeyEmergencyCall; + if (@available(iOS 9.0, *)) { + max = UIReturnKeyContinue; + } + for (UIReturnKeyType i = UIReturnKeyDefault; i <= max; i++) { + NSString *type = [self returnKeyTypeDescription:i]; + if (type) { + [types addObject:type]; + } + } + return [types copy]; +} + + (NSString *_Nullable)activityIndicatorViewStyleDescription:(UIActivityIndicatorViewStyle)style { switch (style) { #ifdef __IPHONE_13_0 From 4fd6f33827d9f1e7e4584094ab782cfd38585d13 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Mon, 28 Oct 2019 11:52:59 +0800 Subject: [PATCH 14/45] Dynamic Segment Control part. --- .../Function/NSObject+LL_Hierarchy.m | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 3e5e8955..06557b15 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -774,20 +774,40 @@ @implementation UITextField (LL_Hierarchy) @implementation UISegmentedControl (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self) weakSelf = self; + NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:self.isMomentary ? @"Momentary" : @"Persistent Selection"] noneInsets]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Momentary" flag:self.isMomentary] noneInsets]; + model1.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.momentary = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model1]; LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Segments" detailTitle:[NSString stringWithFormat:@"%ld",(unsigned long)self.numberOfSegments]]; [settings addObject:model2]; LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Selected Index" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.selectedSegmentIndex]] noneInsets]; + model3.block = ^{ + NSMutableArray *actions = [[NSMutableArray alloc] init]; + for (NSInteger i = 0; i < weakSelf.numberOfSegments; i++) { + [actions addObject:[NSString stringWithFormat:@"%ld",(long)i]]; + } + [weakSelf LL_showActionSheetWithActions:actions currentAction:[NSString stringWithFormat:@"%ld",(long)weakSelf.selectedSegmentIndex] completion:^(NSInteger index) { + weakSelf.selectedSegmentIndex = index; + }]; + }; [settings addObject:model3]; #ifdef __IPHONE_13_0 if (@available(iOS 13.0, *)) { - LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Title" detailTitle:[self LL_hierarchyTextDescription:self.largeContentTitle]] noneInsets]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Large title" detailTitle:[self LL_hierarchyTextDescription:self.largeContentTitle]] noneInsets]; + model4.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.largeContentTitle handler:^(NSString * _Nullable newText) { + weakSelf.largeContentTitle = newText; + }]; + }; [settings addObject:model4]; LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Image" detailTitle: [self LL_hierarchyImageDescription:self.largeContentImage]] noneInsets]; @@ -801,7 +821,11 @@ @implementation UISegmentedControl (LL_Hierarchy) LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Offset" detailTitle:[self LL_hierarchySizeDescription:[self contentOffsetForSegmentAtIndex:self.selectedSegmentIndex]]] noneInsets]; [settings addObject:model7]; - LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Size Mode" detailTitle:self.apportionsSegmentWidthsByContent ? @"Proportional to Content" : @"Equal Widths"] noneInsets]; + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Apportions segment width" flag:self.apportionsSegmentWidthsByContent] noneInsets]; + model8.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.apportionsSegmentWidthsByContent = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model8]; LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Width" detailTitle:[LLFormatterTool formatNumber:@([self widthForSegmentAtIndex:self.selectedSegmentIndex])]]; From 561c40c34c18632e67d8476f94ba2a9eae819656 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Mon, 28 Oct 2019 14:00:57 +0800 Subject: [PATCH 15/45] Dynamic UISlider --- .../Function/NSObject+LL_Hierarchy.m | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 06557b15..88366949 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -847,15 +847,31 @@ @implementation UISegmentedControl (LL_Hierarchy) @implementation UISlider (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self)weakSelf = self; NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Current" detailTitle:[LLFormatterTool formatNumber:@(self.value)]] noneInsets]; + model1.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.value)] handler:^(NSString * _Nullable newText) { + weakSelf.value = [newText floatValue]; + }]; + }; [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Minimum" detailTitle:[LLFormatterTool formatNumber:@(self.minimumValue)]] noneInsets]; + model2.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(self.minimumValue)] handler:^(NSString * _Nullable newText) { + weakSelf.minimumValue = [newText floatValue]; + }]; + }; [settings addObject:model2]; LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Maximum" detailTitle:[LLFormatterTool formatNumber:@(self.maximumValue)]]; + model3.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(self.maximumValue)] handler:^(NSString * _Nullable newText) { + weakSelf.maximumValue = [newText floatValue]; + }]; + }; [settings addObject:model3]; LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Image" detailTitle: [self LL_hierarchyImageDescription:self.minimumValueImage]] noneInsets]; @@ -873,7 +889,11 @@ @implementation UISlider (LL_Hierarchy) LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:@"Thumb Tint" detailTitle:[self LL_hierarchyColorDescription:self.tintColor]]; [settings addObject:model8]; - LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Events" detailTitle:[NSString stringWithFormat:@"Continuous Update %@", [self LL_hierarchyBoolDescription:self.continuous]]]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Continuous" flag:self.isContinuous]; + model9.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.continuous = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model9]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Slider" items:settings]; From 47ee89cefead410950e4ed3bb8fc8fdf37002be9 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Mon, 28 Oct 2019 14:03:44 +0800 Subject: [PATCH 16/45] Dynamic UISwitch. --- .../Component/Hierarchy/Function/NSObject+LL_Hierarchy.m | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 88366949..2a7f29b9 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -912,9 +912,14 @@ @implementation UISlider (LL_Hierarchy) @implementation UISwitch (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self)weakSelf = self; NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"State" detailTitle:[self LL_hierarchyBoolDescription:self.isOn]] noneInsets]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"State" flag:self.isOn] noneInsets]; + model1.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.on = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"On Tint" detailTitle:[self LL_hierarchyColorDescription:self.onTintColor]] noneInsets]; From bc3043288b659610da20e78ee6091bf88abc3127 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Mon, 28 Oct 2019 14:19:52 +0800 Subject: [PATCH 17/45] Dynamic UIActivityIndicatorView --- .../Function/NSObject+LL_Hierarchy.m | 32 ++++++++++- .../EnumDescription/LLEnumDescription.h | 2 + .../EnumDescription/LLEnumDescription.m | 54 +++++++++++++------ 3 files changed, 69 insertions(+), 19 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 2a7f29b9..3abd924c 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -944,18 +944,46 @@ @implementation UISwitch (LL_Hierarchy) @implementation UIActivityIndicatorView (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self)weakSelf = self; NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription activityIndicatorViewStyleDescription:self.activityIndicatorViewStyle]] noneInsets]; + model1.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription activityIndicatorViewStyles] currentAction:[LLEnumDescription activityIndicatorViewStyleDescription:weakSelf.activityIndicatorViewStyle] completion:^(NSInteger index) { + if (index <= UIActivityIndicatorViewStyleGray) { + weakSelf.activityIndicatorViewStyle = index; + } else { + if (@available(iOS 13.0, *)) { + weakSelf.activityIndicatorViewStyle = index + (UIActivityIndicatorViewStyleMedium - UIActivityIndicatorViewStyleGray - 1); + } + } + }]; + }; [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.color]] noneInsets]; [settings addObject:model2]; - LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Animating %@", [self LL_hierarchyBoolDescription:self.isAnimating]]] noneInsets]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Animating" flag:self.isAnimating] noneInsets]; + model3.changePropertyBlock = ^(id _Nullable obj) { + if ([obj boolValue]) { + if (!weakSelf.isAnimating) { + [weakSelf startAnimating]; + }; + } else { + if (weakSelf.isAnimating) { + [weakSelf stopAnimating]; + } + } + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model3]; - LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Hides When Stopped %@", [self LL_hierarchyBoolDescription:self.hidesWhenStopped]]]; + LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:@"Hides When Stopped" flag:self.hidesWhenStopped]; + model4.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.hidesWhenStopped = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model4]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Activity Indicator View" items:settings]; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h index 58164024..994a3b77 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h @@ -92,6 +92,8 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *_Nullable)activityIndicatorViewStyleDescription:(UIActivityIndicatorViewStyle)style; ++ (NSArray *)activityIndicatorViewStyles; + + (NSString *_Nullable)progressViewStyleDescription:(UIProgressViewStyle)style; + (NSString *_Nullable)scrollViewIndicatorStyleDescription:(UIScrollViewIndicatorStyle)style; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m index e544d55b..e76ee45f 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m @@ -53,7 +53,7 @@ + (NSString *)lineBreakModeDescription:(NSLineBreakMode)mode { return [breaks copy]; } -+ (NSString *_Nullable)userInterfaceStyleDescription:(UIUserInterfaceStyle)style { ++ (NSString *)userInterfaceStyleDescription:(UIUserInterfaceStyle)style { switch (style) { case UIUserInterfaceStyleUnspecified: return @"Unspecified"; @@ -65,7 +65,7 @@ + (NSString *_Nullable)userInterfaceStyleDescription:(UIUserInterfaceStyle)style return nil; } -+ (NSString *_Nullable)userInterfaceSizeClassDescription:(UIUserInterfaceSizeClass)sizeClass { ++ (NSString *)userInterfaceSizeClassDescription:(UIUserInterfaceSizeClass)sizeClass { switch (sizeClass) { case UIUserInterfaceSizeClassUnspecified: return @"Unspecified"; @@ -77,7 +77,7 @@ + (NSString *_Nullable)userInterfaceSizeClassDescription:(UIUserInterfaceSizeCla return nil; } -+ (NSString *_Nullable)traitEnvironmentLayoutDirectionDescription:(UITraitEnvironmentLayoutDirection)direction { ++ (NSString *)traitEnvironmentLayoutDirectionDescription:(UITraitEnvironmentLayoutDirection)direction { switch (direction) { case UITraitEnvironmentLayoutDirectionUnspecified: return @"Unspecified"; @@ -89,7 +89,7 @@ + (NSString *_Nullable)traitEnvironmentLayoutDirectionDescription:(UITraitEnviro return nil; } -+ (NSString *_Nullable)viewContentModeDescription:(UIViewContentMode)mode { ++ (NSString *)viewContentModeDescription:(UIViewContentMode)mode { switch (mode) { case UIViewContentModeScaleToFill: return @"ScaleToFill"; @@ -495,7 +495,7 @@ + (NSString *)returnKeyTypeDescription:(UIReturnKeyType)type { return [types copy]; } -+ (NSString *_Nullable)activityIndicatorViewStyleDescription:(UIActivityIndicatorViewStyle)style { ++ (NSString *)activityIndicatorViewStyleDescription:(UIActivityIndicatorViewStyle)style { switch (style) { #ifdef __IPHONE_13_0 case UIActivityIndicatorViewStyleMedium: @@ -516,7 +516,27 @@ + (NSString *_Nullable)activityIndicatorViewStyleDescription:(UIActivityIndicato return nil; } -+ (NSString *_Nullable)progressViewStyleDescription:(UIProgressViewStyle)style { ++ (NSArray *)activityIndicatorViewStyles { + NSMutableArray *styles = [[NSMutableArray alloc] init]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + NSArray *actions = @[@(UIActivityIndicatorViewStyleWhiteLarge),@(UIActivityIndicatorViewStyleWhite),@(UIActivityIndicatorViewStyleGray)]; +#pragma clang diagnostic pop +#ifdef __IPHONE_13_0 + if (@available(iOS 13.0, *)) { + actions = @[@(UIActivityIndicatorViewStyleMedium),@(UIActivityIndicatorViewStyleLarge),@(UIActivityIndicatorViewStyleWhiteLarge),@(UIActivityIndicatorViewStyleWhite),@(UIActivityIndicatorViewStyleGray)]; + } +#endif + for (NSNumber *num in actions) { + NSString *style = [self activityIndicatorViewStyleDescription:[num integerValue]]; + if (style) { + [styles addObject:style]; + } + } + return [styles copy]; +} + ++ (NSString *)progressViewStyleDescription:(UIProgressViewStyle)style { switch (style) { case UIProgressViewStyleDefault: return @"Default"; @@ -526,7 +546,7 @@ + (NSString *_Nullable)progressViewStyleDescription:(UIProgressViewStyle)style { return nil; } -+ (NSString *_Nullable)scrollViewIndicatorStyleDescription:(UIScrollViewIndicatorStyle)style { ++ (NSString *)scrollViewIndicatorStyleDescription:(UIScrollViewIndicatorStyle)style { switch (style) { case UIScrollViewIndicatorStyleDefault: return @"Default"; @@ -538,7 +558,7 @@ + (NSString *_Nullable)scrollViewIndicatorStyleDescription:(UIScrollViewIndicato return nil; } -+ (NSString *_Nullable)scrollViewKeyboardDismissModeDescription:(UIScrollViewKeyboardDismissMode)mode { ++ (NSString *)scrollViewKeyboardDismissModeDescription:(UIScrollViewKeyboardDismissMode)mode { switch (mode) { case UIScrollViewKeyboardDismissModeNone: return @"Do not dismiss"; @@ -550,7 +570,7 @@ + (NSString *_Nullable)scrollViewKeyboardDismissModeDescription:(UIScrollViewKey return nil; } -+ (NSString *_Nullable)tableViewStyleDescription:(UITableViewStyle)style { ++ (NSString *)tableViewStyleDescription:(UITableViewStyle)style { switch (style) { case UITableViewStylePlain: return @"Plain"; @@ -564,7 +584,7 @@ + (NSString *_Nullable)tableViewStyleDescription:(UITableViewStyle)style { return nil; } -+ (NSString *_Nullable)tableViewCellSeparatorStyleDescription:(UITableViewCellSeparatorStyle)style { ++ (NSString *)tableViewCellSeparatorStyleDescription:(UITableViewCellSeparatorStyle)style { switch (style) { case UITableViewCellSeparatorStyleNone: return @"None"; @@ -579,7 +599,7 @@ + (NSString *_Nullable)tableViewCellSeparatorStyleDescription:(UITableViewCellSe return nil; } -+ (NSString *_Nullable)tableViewSeparatorInsetReferenceDescription:(UITableViewSeparatorInsetReference)reference { ++ (NSString *)tableViewSeparatorInsetReferenceDescription:(UITableViewSeparatorInsetReference)reference { switch (reference) { case UITableViewSeparatorInsetFromCellEdges: return @"From Cell Edges"; @@ -589,7 +609,7 @@ + (NSString *_Nullable)tableViewSeparatorInsetReferenceDescription:(UITableViewS return nil; } -+ (NSString *_Nullable)tableViewCellSelectionStyleDescription:(UITableViewCellSelectionStyle)style { ++ (NSString *)tableViewCellSelectionStyleDescription:(UITableViewCellSelectionStyle)style { switch (style) { case UITableViewCellSelectionStyleNone: return @"None"; @@ -603,7 +623,7 @@ + (NSString *_Nullable)tableViewCellSelectionStyleDescription:(UITableViewCellSe return nil; } -+ (NSString *_Nullable)tableViewCellAccessoryTypeDescription:(UITableViewCellAccessoryType)type { ++ (NSString *)tableViewCellAccessoryTypeDescription:(UITableViewCellAccessoryType)type { switch (type) { case UITableViewCellAccessoryNone: return @"None"; @@ -619,7 +639,7 @@ + (NSString *_Nullable)tableViewCellAccessoryTypeDescription:(UITableViewCellAcc return nil; } -+ (NSString *_Nullable)datePickerModeDescription:(UIDatePickerMode)mode { ++ (NSString *)datePickerModeDescription:(UIDatePickerMode)mode { switch (mode) { case UIDatePickerModeDate: return @"Date"; @@ -633,7 +653,7 @@ + (NSString *_Nullable)datePickerModeDescription:(UIDatePickerMode)mode { return nil; } -+ (NSString *_Nullable)barStyleDescription:(UIBarStyle)style { ++ (NSString *)barStyleDescription:(UIBarStyle)style { switch (style) { case UIBarStyleDefault: return @"Default"; @@ -648,7 +668,7 @@ + (NSString *_Nullable)barStyleDescription:(UIBarStyle)style { return nil; } -+ (NSString *_Nullable)searchBarStyleDescription:(UISearchBarStyle)style { ++ (NSString *)searchBarStyleDescription:(UISearchBarStyle)style { switch (style) { case UISearchBarStyleDefault: return @"Default"; @@ -660,7 +680,7 @@ + (NSString *_Nullable)searchBarStyleDescription:(UISearchBarStyle)style { return nil; } -+ (NSString *_Nullable)tabBarItemPositioningDescription:(UITabBarItemPositioning)positioning { ++ (NSString *)tabBarItemPositioningDescription:(UITabBarItemPositioning)positioning { switch (positioning) { case UITabBarItemPositioningAutomatic: return @"Automatic"; From af897986e49265a2f6696c57789c97ca4b739dbc Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Mon, 28 Oct 2019 14:31:13 +0800 Subject: [PATCH 18/45] Dynamic UIProgressView --- .../Hierarchy/Function/NSObject+LL_Hierarchy.m | 11 +++++++++++ .../Core/Others/EnumDescription/LLEnumDescription.h | 2 ++ .../Core/Others/EnumDescription/LLEnumDescription.m | 11 +++++++++++ 3 files changed, 24 insertions(+) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 3abd924c..66957dd5 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -1002,12 +1002,23 @@ @implementation UIActivityIndicatorView (LL_Hierarchy) @implementation UIProgressView (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self)weakSelf = self; NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription progressViewStyleDescription:self.progressViewStyle]]; + model1.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription progressViewStyles] currentAction:[LLEnumDescription progressViewStyleDescription:weakSelf.progressViewStyle] completion:^(NSInteger index) { + weakSelf.progressViewStyle = index; + }]; + }; [settings addObject:model1]; LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Progress" detailTitle:[LLFormatterTool formatNumber:@(self.progress)]]; + model2.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.progress)] handler:^(NSString * _Nullable newText) { + weakSelf.progress = [newText floatValue]; + }]; + }; [settings addObject:model2]; LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Progress Tint" detailTitle:[self LL_hierarchyColorDescription:self.progressTintColor]] noneInsets]; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h index 994a3b77..4140879f 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h @@ -96,6 +96,8 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *_Nullable)progressViewStyleDescription:(UIProgressViewStyle)style; ++ (NSArray *)progressViewStyles; + + (NSString *_Nullable)scrollViewIndicatorStyleDescription:(UIScrollViewIndicatorStyle)style; + (NSString *_Nullable)scrollViewKeyboardDismissModeDescription:(UIScrollViewKeyboardDismissMode)mode; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m index e76ee45f..ad048073 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m @@ -546,6 +546,17 @@ + (NSString *)progressViewStyleDescription:(UIProgressViewStyle)style { return nil; } ++ (NSArray *)progressViewStyles { + NSMutableArray *styles = [[NSMutableArray alloc] init]; + for (UIProgressViewStyle i = UIProgressViewStyleDefault; i <= UIProgressViewStyleBar; i++) { + NSString *style = [self progressViewStyleDescription:i]; + if (style) { + [styles addObject:style]; + } + } + return [styles copy]; +} + + (NSString *)scrollViewIndicatorStyleDescription:(UIScrollViewIndicatorStyle)style { switch (style) { case UIScrollViewIndicatorStyleDefault: From ca4d796570ab564a12be92ac604cbffb92d141c1 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Mon, 28 Oct 2019 14:35:49 +0800 Subject: [PATCH 19/45] Dynamic UIPageControl --- .../Function/NSObject+LL_Hierarchy.m | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 66957dd5..1130e97d 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -1049,12 +1049,33 @@ @implementation UIProgressView (LL_Hierarchy) @implementation UIPageControl (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self)weakSelf = self; NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Pages" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.numberOfPages]] noneInsets]; + model1.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.numberOfPages] handler:^(NSString * _Nullable newText) { + weakSelf.numberOfPages = [newText integerValue]; + }]; + }; [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Current Page" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.currentPage]] noneInsets]; + model2.block = ^{ + if (weakSelf.numberOfPages < 10) { + NSMutableArray *actions = [[NSMutableArray alloc] init]; + for (NSInteger i = 0; i < weakSelf.numberOfPages; i++) { + [actions addObject:[NSString stringWithFormat:@"%ld",(long)i]]; + } + [weakSelf LL_showActionSheetWithActions:actions currentAction:[NSString stringWithFormat:@"%ld",(long)weakSelf.currentPage] completion:^(NSInteger index) { + weakSelf.currentPage = index; + }]; + } else { + [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.currentPage] handler:^(NSString * _Nullable newText) { + weakSelf.currentPage = [newText integerValue]; + }]; + } + }; [settings addObject:model2]; LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Hides for Single Page %@",[self LL_hierarchyBoolDescription:self.hidesForSinglePage]]] noneInsets]; From cfe2267d19373c3a1edb5bd8f5137b48d2c9e346 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Mon, 28 Oct 2019 14:59:19 +0800 Subject: [PATCH 20/45] Dynamic UIStepper --- .../Function/NSObject+LL_Hierarchy.m | 41 +++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 1130e97d..643c2ec2 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -1106,27 +1106,62 @@ @implementation UIPageControl (LL_Hierarchy) @implementation UIStepper (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + + __weak typeof(self)weakSelf = self; + NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Value" detailTitle:[LLFormatterTool formatNumber:@(self.value)]] noneInsets]; + model1.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.value)] handler:^(NSString * _Nullable newText) { + weakSelf.value = [newText doubleValue]; + }]; + }; [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Minimum" detailTitle:[LLFormatterTool formatNumber:@(self.minimumValue)]] noneInsets]; + model2.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.minimumValue)] handler:^(NSString * _Nullable newText) { + weakSelf.minimumValue = [newText doubleValue]; + }]; + }; [settings addObject:model2]; LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Maximum" detailTitle:[LLFormatterTool formatNumber:@(self.maximumValue)]] noneInsets]; + model3.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.maximumValue)] handler:^(NSString * _Nullable newText) { + weakSelf.maximumValue = [newText doubleValue]; + }]; + }; [settings addObject:model3]; LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:@"Step" detailTitle:[LLFormatterTool formatNumber:@(self.stepValue)]]; + model4.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.stepValue)] handler:^(NSString * _Nullable newText) { + weakSelf.stepValue = [newText doubleValue]; + }]; + }; [settings addObject:model4]; - LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Autorepeat %@",[self LL_hierarchyBoolDescription:self.autorepeat]]] noneInsets]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Autorepeat" flag:self.autorepeat] noneInsets]; + model5.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.autorepeat = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model5]; - LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Continuous %@",[self LL_hierarchyBoolDescription:self.continuous]]] noneInsets]; + LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Continuous" flag:self.isContinuous] noneInsets]; + model6.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.continuous = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model6]; - LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Wrap %@",[self LL_hierarchyBoolDescription:self.wraps]]]; + LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:@"Wrap" flag:self.wraps]; + model7.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.wraps = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model7]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Stepper" items:settings]; From ac81ce3bfeccf7b9042cfffbf0454c9c861b57f4 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Mon, 28 Oct 2019 15:28:58 +0800 Subject: [PATCH 21/45] Dynamic UIScrollView. --- .../Function/NSObject+LL_Hierarchy.m | 82 ++++++++++++++++--- .../EnumDescription/LLEnumDescription.h | 4 + .../EnumDescription/LLEnumDescription.m | 22 +++++ 3 files changed, 98 insertions(+), 10 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 643c2ec2..15e0357a 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -1180,51 +1180,113 @@ @implementation UIStepper (LL_Hierarchy) @implementation UIScrollView (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self)weakSelf = self; + NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription scrollViewIndicatorStyleDescription:self.indicatorStyle]]; + model1.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription scrollViewIndicatorStyles] currentAction:[LLEnumDescription scrollViewIndicatorStyleDescription:weakSelf.indicatorStyle] completion:^(NSInteger index) { + weakSelf.indicatorStyle = index; + }]; + }; [settings addObject:model1]; - LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Indicators" detailTitle:[NSString stringWithFormat:@"Shows Horizontal Indicator %@",[self LL_hierarchyBoolDescription:self.showsHorizontalScrollIndicator]]] noneInsets]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Shows Horizontal Indicator" flag:self.showsHorizontalScrollIndicator] noneInsets]; + model2.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.showsHorizontalScrollIndicator = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model2]; - LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Vertical Indicator %@",[self LL_hierarchyBoolDescription:self.showsVerticalScrollIndicator]]]; + LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Shows Vertical Indicator" flag:self.showsVerticalScrollIndicator]; + model3.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.showsVerticalScrollIndicator = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model3]; - LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Scrolling" detailTitle:[NSString stringWithFormat:@"Scrolling %@", self.scrollEnabled ? @"Enabled" : @"Not Enabled"]] noneInsets]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Scroll enable" flag:self.isScrollEnabled] noneInsets]; + model4.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.scrollEnabled = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model4]; - LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Paging %@", self.pagingEnabled ? @"Enabled" : @"Disabled"]] noneInsets]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Page enable" flag:self.isPagingEnabled] noneInsets]; + model5.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.pagingEnabled = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model5]; - LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Direction Lock %@",self.isDirectionalLockEnabled ? @"Enabled" : @"Disabled"]]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Direction lock enable" flag:weakSelf.isDirectionalLockEnabled]; + model6.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.directionalLockEnabled = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model6]; - LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Bounce" detailTitle:[NSString stringWithFormat:@"Bounces %@",[self LL_hierarchyBoolDescription:self.bounces]]] noneInsets]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Bounce" flag:self.bounces] noneInsets]; + model7.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.bounces = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model7]; - LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Bounce Horizontal %@",[self LL_hierarchyBoolDescription:self.alwaysBounceHorizontal]]] noneInsets]; + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Bounce Horizontal" flag:self.alwaysBounceHorizontal] noneInsets]; + model8.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.alwaysBounceHorizontal = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model8]; - LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Bounce Vertical %@",[self LL_hierarchyBoolDescription:self.alwaysBounceVertical]]]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Bounce Vertical" flag:self.alwaysBounceVertical]; + model9.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.alwaysBounceVertical = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model9]; LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Zoom Min" detailTitle:[LLFormatterTool formatNumber:@(self.minimumZoomScale)]] noneInsets]; + model10.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.minimumZoomScale)] handler:^(NSString * _Nullable newText) { + weakSelf.minimumZoomScale = [newText doubleValue]; + }]; + }; [settings addObject:model10]; LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:@"Max" detailTitle:[LLFormatterTool formatNumber:@(self.maximumZoomScale)]]; + model11.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.maximumZoomScale)] handler:^(NSString * _Nullable newText) { + weakSelf.maximumZoomScale = [newText doubleValue]; + }]; + }; [settings addObject:model11]; LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Touch" detailTitle:[NSString stringWithFormat:@"Zoom Bounces %@",[self LL_hierarchyBoolDescription:self.isZoomBouncing]]] noneInsets]; [settings addObject:model12]; - LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Delays Content Touches %@",[self LL_hierarchyBoolDescription:self.delaysContentTouches]]] noneInsets]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:@"Delays Content Touches" flag:self.delaysContentTouches] noneInsets]; + model13.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.delaysContentTouches = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model13]; - LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Cancellable Content Touches %@",[self LL_hierarchyBoolDescription:self.canCancelContentTouches]]]; + LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:@"Cancellable Content Touches" flag:self.canCancelContentTouches]; + model14.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.canCancelContentTouches = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model14]; LLTitleCellModel *model15 = [[LLTitleCellModel alloc] initWithTitle:@"Keyboard" detailTitle:[LLEnumDescription scrollViewKeyboardDismissModeDescription:self.keyboardDismissMode]]; + model15.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription scrollViewKeyboardDismissModes] currentAction:[LLEnumDescription scrollViewKeyboardDismissModeDescription:weakSelf.keyboardDismissMode] completion:^(NSInteger index) { + weakSelf.keyboardDismissMode = index; + }]; + }; [settings addObject:model15]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Scroll View" items:settings]; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h index 4140879f..4f1266d2 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h @@ -100,8 +100,12 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *_Nullable)scrollViewIndicatorStyleDescription:(UIScrollViewIndicatorStyle)style; ++ (NSArray *)scrollViewIndicatorStyles; + + (NSString *_Nullable)scrollViewKeyboardDismissModeDescription:(UIScrollViewKeyboardDismissMode)mode; ++ (NSArray *)scrollViewKeyboardDismissModes; + + (NSString *_Nullable)tableViewStyleDescription:(UITableViewStyle)style; + (NSString *_Nullable)tableViewCellSeparatorStyleDescription:(UITableViewCellSeparatorStyle)style; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m index ad048073..bccf97ad 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m @@ -569,6 +569,17 @@ + (NSString *)scrollViewIndicatorStyleDescription:(UIScrollViewIndicatorStyle)st return nil; } ++ (NSArray *)scrollViewIndicatorStyles { + NSMutableArray *styles = [[NSMutableArray alloc] init]; + for (UIScrollViewIndicatorStyle i = UIScrollViewIndicatorStyleDefault; i <= UIScrollViewIndicatorStyleWhite; i++) { + NSString *style = [self scrollViewIndicatorStyleDescription:i]; + if (style) { + [styles addObject:style]; + } + } + return [styles copy]; +} + + (NSString *)scrollViewKeyboardDismissModeDescription:(UIScrollViewKeyboardDismissMode)mode { switch (mode) { case UIScrollViewKeyboardDismissModeNone: @@ -581,6 +592,17 @@ + (NSString *)scrollViewKeyboardDismissModeDescription:(UIScrollViewKeyboardDism return nil; } ++ (NSArray *)scrollViewKeyboardDismissModes { + NSMutableArray *modes = [[NSMutableArray alloc] init]; + for (UIScrollViewKeyboardDismissMode i = UIScrollViewKeyboardDismissModeNone; i <= UIScrollViewKeyboardDismissModeInteractive; i++) { + NSString *mode = [self scrollViewKeyboardDismissModeDescription:i]; + if (mode) { + [modes addObject:mode]; + } + } + return [modes copy]; +} + + (NSString *)tableViewStyleDescription:(UITableViewStyle)style { switch (style) { case UITableViewStylePlain: From fe4519320b146f59af3318ad56e9134b682b0610 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Mon, 28 Oct 2019 16:40:37 +0800 Subject: [PATCH 22/45] Update title cell. --- .../Core/Others/CommonUI/View/TitleCell/LLDetailTitleCell.h | 2 ++ .../Core/Others/CommonUI/View/TitleCell/LLDetailTitleCell.m | 4 +++- .../Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.h | 1 + .../Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m | 5 +++++ .../Core/Others/CommonUI/View/TitleCell/LLTitleSwitchCell.h | 5 ++--- .../Core/Others/CommonUI/View/TitleCell/LLTitleSwitchCell.m | 3 +++ 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLDetailTitleCell.h b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLDetailTitleCell.h index 069f69cd..a16d403d 100644 --- a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLDetailTitleCell.h +++ b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLDetailTitleCell.h @@ -29,6 +29,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, strong, readonly) UILabel *detailLabel; +@property (nonatomic, strong, readonly) MASConstraint *detailLabelRightCons; + @end NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLDetailTitleCell.m b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLDetailTitleCell.m index 6d7f291b..02bf966d 100644 --- a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLDetailTitleCell.m +++ b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLDetailTitleCell.m @@ -31,6 +31,8 @@ @interface LLDetailTitleCell () @property (nonatomic, strong) UILabel *detailLabel; +@property (nonatomic, strong) MASConstraint *detailLabelRightCons; + @end @implementation LLDetailTitleCell @@ -44,7 +46,7 @@ - (void)initUI { [self.titleLabelBottomCons uninstall]; [self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.mas_equalTo(-kLLGeneralMargin); + self.detailLabelRightCons = make.right.mas_equalTo(-kLLGeneralMargin); make.top.mas_equalTo(kLLGeneralMargin); make.bottom.mas_equalTo(-kLLGeneralMargin); make.left.equalTo(self.titleLabel.mas_right).offset(kLLGeneralMargin / 2.0); diff --git a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.h b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.h index fa43fb5c..d6a96e3c 100644 --- a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.h +++ b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.h @@ -59,6 +59,7 @@ typedef void(^LLSettingModelChangePropertyBlock)(__nullable id obj); // LLTitleSwitchCell - (instancetype)initWithTitle:(NSString *_Nullable)title flag:(BOOL)flag; +- (instancetype)initWithTitle:(NSString *_Nullable)title detailTitle:(NSString *_Nullable)detailTitle flag:(BOOL)flag; // LLDetailTitleCell - (instancetype)initWithTitle:(NSString *_Nullable)title detailTitle:(NSString *_Nullable)detailTitle; diff --git a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m index 728f24b3..a4d5eb02 100644 --- a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m +++ b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleCellModel.m @@ -32,8 +32,13 @@ @implementation LLTitleCellModel - (instancetype)initWithTitle:(NSString *)title flag:(BOOL)flag { + return [self initWithTitle:title detailTitle:nil flag:flag]; +} + +- (instancetype)initWithTitle:(NSString *_Nullable)title detailTitle:(NSString *_Nullable)detailTitle flag:(BOOL)flag { if (self = [super init]) { _title = [title copy]; + _detailTitle = [detailTitle copy]; _flag = flag; _cellClass = NSStringFromClass(LLTitleSwitchCell.class); _separatorInsets = UIEdgeInsetsMake(0, kLLGeneralMargin, 0, 0); diff --git a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleSwitchCell.h b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleSwitchCell.h index 2cd54dab..db37fa9b 100644 --- a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleSwitchCell.h +++ b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleSwitchCell.h @@ -21,12 +21,11 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#import "LLTitleCell.h" -#import "LLTitleCellModel.h" +#import "LLDetailTitleCell.h" NS_ASSUME_NONNULL_BEGIN -@interface LLTitleSwitchCell : LLTitleCell +@interface LLTitleSwitchCell : LLDetailTitleCell @end diff --git a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleSwitchCell.m b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleSwitchCell.m index f269b524..309082d8 100644 --- a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleSwitchCell.m +++ b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleSwitchCell.m @@ -40,7 +40,10 @@ - (void)initUI { [super initUI]; [self.contentView addSubview:self.swit]; + [self.detailLabelRightCons uninstall]; + [self.swit mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.equalTo(self.detailLabel.mas_right).offset(kLLGeneralMargin / 2.0); make.right.mas_equalTo(-kLLGeneralMargin); make.top.mas_equalTo(kLLGeneralMargin); make.bottom.mas_equalTo(-kLLGeneralMargin); From 9bee262067171c24f062e2cc59361857444c2e3c Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Mon, 28 Oct 2019 16:52:40 +0800 Subject: [PATCH 23/45] Dynamic UITableView. --- .../Function/NSObject+LL_Hierarchy.m | 60 +++++++++++++++++-- .../EnumDescription/LLEnumDescription.h | 4 ++ .../EnumDescription/LLEnumDescription.m | 22 +++++++ 3 files changed, 82 insertions(+), 4 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 15e0357a..12375dd8 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -1305,6 +1305,7 @@ @implementation UIScrollView (LL_Hierarchy) @implementation UITableView (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self)weakSelf = self; NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Sections" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.numberOfSections]] noneInsets]; @@ -1314,6 +1315,11 @@ @implementation UITableView (LL_Hierarchy) [settings addObject:model2]; LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Separator" detailTitle:[LLEnumDescription tableViewCellSeparatorStyleDescription:self.separatorStyle]] noneInsets]; + model3.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription tableViewCellSeparatorStyles] currentAction:[LLEnumDescription tableViewCellSeparatorStyleDescription:weakSelf.separatorStyle] completion:^(NSInteger index) { + weakSelf.separatorStyle = index; + }]; + }; [settings addObject:model3]; LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyColorDescription:self.separatorColor]]; @@ -1326,6 +1332,11 @@ @implementation UITableView (LL_Hierarchy) [settings addObject:model6]; LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Separator Inset" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.separatorInset]] noneInsets]; + model7.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromUIEdgeInsets(weakSelf.separatorInset) handler:^(NSString * _Nullable newText) { + weakSelf.separatorInset = [weakSelf LL_insetsFromString:newText originalInsets:weakSelf.separatorInset]; + }]; + }; [settings addObject:model7]; LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.separatorInset]] noneInsets]; @@ -1333,22 +1344,48 @@ @implementation UITableView (LL_Hierarchy) if (@available(iOS 11.0, *)) { LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[LLEnumDescription tableViewSeparatorInsetReferenceDescription:self.separatorInsetReference]]; + model9.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription tableViewSeparatorInsetReferences] currentAction:[LLEnumDescription tableViewSeparatorInsetReferenceDescription:weakSelf.separatorInsetReference] completion:^(NSInteger index) { + weakSelf.separatorInsetReference = index; + }]; + }; [settings addObject:model9]; } - LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Selection" detailTitle:self.allowsSelection ? @"Allowed" : @"Disabled"] noneInsets]; + LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Selection" detailTitle:self.allowsSelection ? @"Allowed" : @"Disabled" flag:self.allowsSelection] noneInsets]; + model10.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.allowsSelection = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model10]; - LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Multiple Selection %@",self.allowsMultipleSelection ? @"" : @"Disabled"]] noneInsets]; + LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Multiple Selection %@",self.allowsMultipleSelection ? @"" : @"Disabled"] flag:self.allowsMultipleSelection] noneInsets]; + model11.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.allowsMultipleSelection = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model11]; - LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Edit Selection" detailTitle:self.allowsSelectionDuringEditing ? @"Allowed" : @"Disabled"] noneInsets]; + LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Edit Selection" detailTitle:self.allowsSelectionDuringEditing ? @"Allowed" : @"Disabled" flag:self.allowsSelectionDuringEditing] noneInsets]; + model12.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.allowsSelectionDuringEditing = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model12]; - LLTitleCellModel *model13 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Multiple Selection %@",self.allowsMultipleSelection ? @"" : @"Disabled"]]; + LLTitleCellModel *model13 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Multiple Selection %@",self.allowsMultipleSelectionDuringEditing ? @"" : @"Disabled"] flag:self.allowsMultipleSelectionDuringEditing]; + model13.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.allowsMultipleSelectionDuringEditing = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model13]; LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Display" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.sectionIndexMinimumDisplayRowCount]] noneInsets]; + model14.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%ld",(long)self.sectionIndexMinimumDisplayRowCount] handler:^(NSString * _Nullable newText) { + weakSelf.sectionIndexMinimumDisplayRowCount = [newText integerValue]; + }]; + }; [settings addObject:model14]; LLTitleCellModel *model15 = [[[LLTitleCellModel alloc] initWithTitle:@"Text" detailTitle:[self LL_hierarchyColorDescription:self.sectionIndexColor]] noneInsets]; @@ -1361,12 +1398,27 @@ @implementation UITableView (LL_Hierarchy) [settings addObject:model17]; LLTitleCellModel *model18 = [[[LLTitleCellModel alloc] initWithTitle:@"Row Height" detailTitle:[LLFormatterTool formatNumber:@(self.rowHeight)]] noneInsets]; + model18.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.rowHeight)] handler:^(NSString * _Nullable newText) { + weakSelf.rowHeight = [newText doubleValue]; + }]; + }; [settings addObject:model18]; LLTitleCellModel *model19 = [[[LLTitleCellModel alloc] initWithTitle:@"Section Header" detailTitle:[LLFormatterTool formatNumber:@(self.sectionHeaderHeight)]] noneInsets]; + model19.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(self.sectionHeaderHeight)] handler:^(NSString * _Nullable newText) { + weakSelf.sectionHeaderHeight = [newText doubleValue]; + }]; + }; [settings addObject:model19]; LLTitleCellModel *model20 = [[LLTitleCellModel alloc] initWithTitle:@"Section Footer" detailTitle:[LLFormatterTool formatNumber:@(self.sectionFooterHeight)]]; + model20.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.sectionFooterHeight)] handler:^(NSString * _Nullable newText) { + weakSelf.sectionFooterHeight = [newText doubleValue]; + }]; + }; [settings addObject:model20]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Table View" items:settings]; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h index 4f1266d2..8135e711 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h @@ -110,8 +110,12 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *_Nullable)tableViewCellSeparatorStyleDescription:(UITableViewCellSeparatorStyle)style; ++ (NSArray *)tableViewCellSeparatorStyles; + + (NSString *_Nullable)tableViewSeparatorInsetReferenceDescription:(UITableViewSeparatorInsetReference)reference API_AVAILABLE(ios(11.0)); ++ (NSArray *)tableViewSeparatorInsetReferences API_AVAILABLE(ios(11.0)); + + (NSString *_Nullable)tableViewCellSelectionStyleDescription:(UITableViewCellSelectionStyle)style; + (NSString *_Nullable)tableViewCellAccessoryTypeDescription:(UITableViewCellAccessoryType)type; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m index bccf97ad..f2674d24 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m @@ -632,6 +632,17 @@ + (NSString *)tableViewCellSeparatorStyleDescription:(UITableViewCellSeparatorSt return nil; } ++ (NSArray *)tableViewCellSeparatorStyles { + NSMutableArray *styles = [[NSMutableArray alloc] init]; + for (UITableViewCellSeparatorStyle i = UITableViewCellSeparatorStyleNone; i <= UITableViewCellSeparatorStyleSingleLineEtched; i++) { + NSString *style = [self tableViewCellSeparatorStyleDescription:i]; + if (style) { + [styles addObject:style]; + } + } + return [styles copy]; +} + + (NSString *)tableViewSeparatorInsetReferenceDescription:(UITableViewSeparatorInsetReference)reference { switch (reference) { case UITableViewSeparatorInsetFromCellEdges: @@ -642,6 +653,17 @@ + (NSString *)tableViewSeparatorInsetReferenceDescription:(UITableViewSeparatorI return nil; } ++ (NSArray *)tableViewSeparatorInsetReferences { + NSMutableArray *references = [[NSMutableArray alloc] init]; + for (UITableViewSeparatorInsetReference i = UITableViewSeparatorInsetFromCellEdges; i <= UITableViewSeparatorInsetFromAutomaticInsets; i++) { + NSString *reference = [self tableViewSeparatorInsetReferenceDescription:i]; + if (reference) { + [references addObject:reference]; + } + } + return [references copy]; +} + + (NSString *)tableViewCellSelectionStyleDescription:(UITableViewCellSelectionStyle)style { switch (style) { case UITableViewCellSelectionStyleNone: From 6a6a72d97393347af23bf3ef1818bb77116cff28 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Mon, 28 Oct 2019 17:29:03 +0800 Subject: [PATCH 24/45] Dynamic UITableViewCell --- .../Function/NSObject+LL_Hierarchy.m | 44 +++++++++++++++++-- .../EnumDescription/LLEnumDescription.h | 4 ++ .../EnumDescription/LLEnumDescription.m | 22 ++++++++++ 3 files changed, 67 insertions(+), 3 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 12375dd8..aa667d7a 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -1437,7 +1437,7 @@ @implementation UITableView (LL_Hierarchy) @implementation UITableViewCell (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { - + __weak typeof(self) weakSelf = self; NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[LLTitleCellModel alloc] initWithTitle:@"Image" detailTitle:[self LL_hierarchyImageDescription:self.imageView.image]]; @@ -1447,27 +1447,65 @@ @implementation UITableViewCell (LL_Hierarchy) [settings addObject:model2]; LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Selection" detailTitle:[LLEnumDescription tableViewCellSelectionStyleDescription:self.selectionStyle]] noneInsets]; + model3.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription tableViewCellSelectionStyles] currentAction:[LLEnumDescription tableViewCellSelectionStyleDescription:weakSelf.selectionStyle] completion:^(NSInteger index) { + weakSelf.selectionStyle = index; + }]; + }; [settings addObject:model3]; LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Accessory" detailTitle:[LLEnumDescription tableViewCellAccessoryTypeDescription:self.accessoryType]] noneInsets]; + model4.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription tableViewCellAccessoryTypes] currentAction:[LLEnumDescription tableViewCellAccessoryTypeDescription:weakSelf.accessoryType] completion:^(NSInteger index) { + weakSelf.accessoryType = index; + }]; + }; [settings addObject:model4]; LLTitleCellModel *model5 = [[LLTitleCellModel alloc] initWithTitle:@"Editing Acc." detailTitle:[LLEnumDescription tableViewCellAccessoryTypeDescription:self.editingAccessoryType]]; + model5.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription tableViewCellAccessoryTypes] currentAction:[LLEnumDescription tableViewCellAccessoryTypeDescription:weakSelf.editingAccessoryType] completion:^(NSInteger index) { + weakSelf.editingAccessoryType = index; + }]; + }; [settings addObject:model5]; LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Indentation" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.indentationLevel]] noneInsets]; + model6.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.indentationLevel] handler:^(NSString * _Nullable newText) { + weakSelf.indentationLevel = [newText integerValue]; + }]; + }; [settings addObject:model6]; LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[LLFormatterTool formatNumber:@(self.indentationWidth)]] noneInsets]; + model7.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.indentationWidth)] handler:^(NSString * _Nullable newText) { + weakSelf.indentationWidth = [newText doubleValue]; + }]; + }; [settings addObject:model7]; - LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Indent While Editing %@",[self LL_hierarchyBoolDescription:self.shouldIndentWhileEditing]]] noneInsets]; + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Indent While Editing %@",[self LL_hierarchyBoolDescription:self.shouldIndentWhileEditing]] flag:self.shouldIndentWhileEditing] noneInsets]; + model8.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.shouldIndentWhileEditing = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model8]; - LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Re-order Controls %@",[self LL_hierarchyBoolDescription:self.showsReorderControl]]]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Re-order Controls %@",[self LL_hierarchyBoolDescription:self.showsReorderControl]] flag:self.showsReorderControl]; + model9.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.showsReorderControl = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model9]; LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Separator Inset" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.separatorInset]] noneInsets]; + model10.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromUIEdgeInsets(weakSelf.separatorInset) handler:^(NSString * _Nullable newText) { + weakSelf.separatorInset = [weakSelf LL_insetsFromString:newText originalInsets:weakSelf.separatorInset]; + }]; + }; [settings addObject:model10]; LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyInsetsLeftRightDescription:self.separatorInset]]; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h index 8135e711..cd26c42f 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h @@ -118,8 +118,12 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *_Nullable)tableViewCellSelectionStyleDescription:(UITableViewCellSelectionStyle)style; ++ (NSArray *)tableViewCellSelectionStyles; + + (NSString *_Nullable)tableViewCellAccessoryTypeDescription:(UITableViewCellAccessoryType)type; ++ (NSArray *)tableViewCellAccessoryTypes; + + (NSString *_Nullable)datePickerModeDescription:(UIDatePickerMode)mode; + (NSString *_Nullable)barStyleDescription:(UIBarStyle)style; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m index f2674d24..682d72ff 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m @@ -678,6 +678,17 @@ + (NSString *)tableViewCellSelectionStyleDescription:(UITableViewCellSelectionSt return nil; } ++ (NSArray *)tableViewCellSelectionStyles { + NSMutableArray *styles = [[NSMutableArray alloc] init]; + for (UITableViewCellSelectionStyle i = UITableViewCellSelectionStyleNone; i <= UITableViewCellSelectionStyleDefault; i++) { + NSString *style = [self tableViewCellSelectionStyleDescription:i]; + if (style) { + [styles addObject:style]; + } + } + return [styles copy]; +} + + (NSString *)tableViewCellAccessoryTypeDescription:(UITableViewCellAccessoryType)type { switch (type) { case UITableViewCellAccessoryNone: @@ -694,6 +705,17 @@ + (NSString *)tableViewCellAccessoryTypeDescription:(UITableViewCellAccessoryTyp return nil; } ++ (NSArray *)tableViewCellAccessoryTypes { + NSMutableArray *types = [[NSMutableArray alloc] init]; + for (UITableViewCellAccessoryType i = UITableViewCellAccessoryNone; i <= UITableViewCellAccessoryDetailButton; i++) { + NSString *type = [self tableViewCellAccessoryTypeDescription:i]; + if (type) { + [types addObject:type]; + } + } + return [types copy]; +} + + (NSString *)datePickerModeDescription:(UIDatePickerMode)mode { switch (mode) { case UIDatePickerModeDate: From fe0f7c96b911fe39954014c7cd4e5d85d09bf04c Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Mon, 28 Oct 2019 18:27:46 +0800 Subject: [PATCH 25/45] Dynamic UITextView. --- .../Function/NSObject+LL_Hierarchy.m | 142 ++++++++++++++++-- 1 file changed, 129 insertions(+), 13 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index aa667d7a..528cbe8c 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -1578,76 +1578,192 @@ @implementation UICollectionReusableView (LL_Hierarchy) @implementation UITextView (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self)weakSelf = self; + NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Plain Text" detailTitle:[self LL_hierarchyTextDescription:self.text]] noneInsets]; + model1.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.text handler:^(NSString * _Nullable newText) { + weakSelf.text = newText; + }]; + }; [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Attributed Text" detailTitle:[self LL_hierarchyObjectDescription:self.attributedText]] noneInsets]; + model2.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.attributedText.string handler:^(NSString * _Nullable newText) { + [weakSelf LL_replaceAttributeString:newText key:@"attributedText"]; + }]; + }; [settings addObject:model2]; - LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Allows Editing Attributes %@",[self LL_hierarchyBoolDescription:self.allowsEditingTextAttributes]]] noneInsets]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Allows Editing Attributes %@",[self LL_hierarchyBoolDescription:self.allowsEditingTextAttributes]] flag:self.allowsEditingTextAttributes] noneInsets]; + model3.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.allowsEditingTextAttributes = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model3]; LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.textColor]] noneInsets]; [settings addObject:model4]; LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Font" detailTitle:[self LL_hierarchyObjectDescription:self.font]] noneInsets]; + model5.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(weakSelf.font.pointSize)]] handler:^(NSString * _Nullable newText) { + weakSelf.font = [weakSelf.font fontWithSize:[newText doubleValue]]; + }]; + }; [settings addObject:model5]; LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Alignment" detailTitle:[LLEnumDescription textAlignmentDescription:self.textAlignment]]; + model6.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription textAlignments] currentAction:[LLEnumDescription textAlignmentDescription:weakSelf.textAlignment] completion:^(NSInteger index) { + weakSelf.textAlignment = index; + }]; + }; [settings addObject:model6]; - LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Editable %@",[self LL_hierarchyBoolDescription:self.isEditable]]] noneInsets]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Editable %@",[self LL_hierarchyBoolDescription:self.isEditable]] flag:self.isEditable] noneInsets]; + model7.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.editable = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model7]; - LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Selectable %@",[self LL_hierarchyBoolDescription:self.isSelectable]]]; + LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Selectable %@",[self LL_hierarchyBoolDescription:self.isSelectable]] flag:self.isSelectable]; + model8.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.selectable = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model8]; - LLTitleCellModel *model9 = [[[LLTitleCellModel alloc] initWithTitle:@"Data Detectors" detailTitle:[NSString stringWithFormat:@"Phone Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypePhoneNumber]]] noneInsets]; + LLTitleCellModel *model9 = [[[LLTitleCellModel alloc] initWithTitle:@"Data Detectors" detailTitle:[NSString stringWithFormat:@"Phone Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypePhoneNumber]] flag:self.dataDetectorTypes & UIDataDetectorTypePhoneNumber] noneInsets]; + model9.changePropertyBlock = ^(id _Nullable obj) { + if ([obj boolValue]) { + weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes | UIDataDetectorTypePhoneNumber; + } else { + weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes & ~UIDataDetectorTypePhoneNumber; + } + }; [settings addObject:model9]; - LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Link %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeLink]]] noneInsets]; + LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Link %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeLink]] flag:self.dataDetectorTypes & UIDataDetectorTypeLink] noneInsets]; + model10.changePropertyBlock = ^(id _Nullable obj) { + if ([obj boolValue]) { + weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes | UIDataDetectorTypeLink; + } else { + weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes & ~UIDataDetectorTypeLink; + } + }; [settings addObject:model10]; - LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Address %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeAddress]]] noneInsets]; + LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Address %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeAddress]] flag:self.dataDetectorTypes & UIDataDetectorTypeAddress] noneInsets]; + model11.changePropertyBlock = ^(id _Nullable obj) { + if ([obj boolValue]) { + weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes | UIDataDetectorTypeAddress; + } else { + weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes & ~UIDataDetectorTypeAddress; + } + }; [settings addObject:model11]; - LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Calendar Event %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeCalendarEvent]]] noneInsets]; + LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Calendar Event %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeCalendarEvent]] flag:self.dataDetectorTypes & UIDataDetectorTypeCalendarEvent] noneInsets]; + model12.changePropertyBlock = ^(id _Nullable obj) { + if ([obj boolValue]) { + weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes | UIDataDetectorTypeCalendarEvent; + } else { + weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes & ~UIDataDetectorTypeCalendarEvent; + } + }; [settings addObject:model12]; if (@available(iOS 10.0, *)) { - LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shipment Tracking Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeShipmentTrackingNumber]]] noneInsets]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shipment Tracking Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeShipmentTrackingNumber]] flag:self.dataDetectorTypes & UIDataDetectorTypeShipmentTrackingNumber] noneInsets]; + model13.changePropertyBlock = ^(id _Nullable obj) { + if ([obj boolValue]) { + weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes | UIDataDetectorTypeShipmentTrackingNumber; + } else { + weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes & ~UIDataDetectorTypeShipmentTrackingNumber; + } + }; [settings addObject:model13]; - LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Flight Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeFlightNumber]]] noneInsets]; + LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Flight Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeFlightNumber]] flag:self.dataDetectorTypes & UIDataDetectorTypeFlightNumber] noneInsets]; + model14.changePropertyBlock = ^(id _Nullable obj) { + if ([obj boolValue]) { + weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes | UIDataDetectorTypeFlightNumber; + } else { + weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes & ~UIDataDetectorTypeFlightNumber; + } + }; [settings addObject:model14]; - LLTitleCellModel *model15 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Lookup Suggestion %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeLookupSuggestion]]]; + LLTitleCellModel *model15 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Lookup Suggestion %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeLookupSuggestion]] flag:self.dataDetectorTypes & UIDataDetectorTypeLookupSuggestion]; + model15.changePropertyBlock = ^(id _Nullable obj) { + if ([obj boolValue]) { + weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes | UIDataDetectorTypeLookupSuggestion; + } else { + weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes & ~UIDataDetectorTypeLookupSuggestion; + } + }; [settings addObject:model15]; } else { - model12.separatorInsets = UIEdgeInsetsMake(0, kLLGeneralMargin, 0, 0); + [model12 normalInsets]; } LLTitleCellModel *model16 = [[[LLTitleCellModel alloc] initWithTitle:@"Capitalization" detailTitle:[LLEnumDescription textAutocapitalizationTypeDescription:self.autocapitalizationType]] noneInsets]; + model16.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription textAutocapitalizationTypes] currentAction:[LLEnumDescription textAutocapitalizationTypeDescription:weakSelf.autocapitalizationType] completion:^(NSInteger index) { + weakSelf.autocapitalizationType = index; + }]; + }; [settings addObject:model16]; LLTitleCellModel *model17 = [[[LLTitleCellModel alloc] initWithTitle:@"Correction" detailTitle:[LLEnumDescription textAutocorrectionTypeDescription:self.autocorrectionType]] noneInsets]; + model17.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription textAutocorrectionTypes] currentAction:[LLEnumDescription textAutocorrectionTypeDescription:weakSelf.autocorrectionType] completion:^(NSInteger index) { + weakSelf.autocorrectionType = index; + }]; + }; [settings addObject:model17]; LLTitleCellModel *model18 = [[[LLTitleCellModel alloc] initWithTitle:@"Keyboard" detailTitle:[LLEnumDescription keyboardTypeDescription:self.keyboardType]] noneInsets]; + model18.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription keyboardTypes] currentAction:[LLEnumDescription keyboardTypeDescription:weakSelf.keyboardType] completion:^(NSInteger index) { + weakSelf.keyboardType = index; + }]; + }; [settings addObject:model18]; LLTitleCellModel *model19 = [[[LLTitleCellModel alloc] initWithTitle:@"Appearance" detailTitle:[LLEnumDescription keyboardAppearanceDescription:self.keyboardAppearance]] noneInsets]; + model19.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription keyboardAppearances] currentAction:[LLEnumDescription keyboardAppearanceDescription:weakSelf.keyboardAppearance] completion:^(NSInteger index) { + weakSelf.keyboardAppearance = index; + }]; + }; [settings addObject:model19]; LLTitleCellModel *model20 = [[[LLTitleCellModel alloc] initWithTitle:@"Return Key" detailTitle:[LLEnumDescription returnKeyTypeDescription:self.returnKeyType]] noneInsets]; + model20.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription returnKeyTypes] currentAction:[LLEnumDescription returnKeyTypeDescription:weakSelf.returnKeyType] completion:^(NSInteger index) { + weakSelf.returnKeyType = index; + }]; + }; [settings addObject:model20]; - LLTitleCellModel *model21 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Auto-enable Return Key %@",[self LL_hierarchyBoolDescription:self.enablesReturnKeyAutomatically]]] noneInsets]; + LLTitleCellModel *model21 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Auto-enable Return Key %@",[self LL_hierarchyBoolDescription:self.enablesReturnKeyAutomatically]] flag:self.enablesReturnKeyAutomatically] noneInsets]; + model21.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.enablesReturnKeyAutomatically = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model21]; - LLTitleCellModel *model22 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Secure Entry %@",[self LL_hierarchyBoolDescription:self.isSecureTextEntry]]]; + LLTitleCellModel *model22 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Secure Entry %@",[self LL_hierarchyBoolDescription:self.isSecureTextEntry]] flag:self.isSecureTextEntry]; + model22.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.secureTextEntry = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model22]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Text View" items:settings]; From 2abc7f1b8885785363ff8de4ffc168c4b9e1a8fb Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Mon, 28 Oct 2019 18:32:28 +0800 Subject: [PATCH 26/45] Dynamic date part(unfinished). --- .../Hierarchy/Function/NSObject+LL_Hierarchy.m | 11 +++++++++++ .../Core/Others/EnumDescription/LLEnumDescription.h | 2 ++ .../Core/Others/EnumDescription/LLEnumDescription.m | 11 +++++++++++ 3 files changed, 24 insertions(+) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 528cbe8c..b2d9f144 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -1782,15 +1782,26 @@ @implementation UITextView (LL_Hierarchy) @implementation UIDatePicker (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self) weakSelf = self; NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Mode" detailTitle:[LLEnumDescription datePickerModeDescription:self.datePickerMode]] noneInsets]; + model1.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription datePickerModes] currentAction:[LLEnumDescription datePickerModeDescription:weakSelf.datePickerMode] completion:^(NSInteger index) { + weakSelf.datePickerMode = index; + }]; + }; [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Locale Identifier" detailTitle:self.locale.localeIdentifier] noneInsets]; [settings addObject:model2]; LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Interval" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.minuteInterval]]; + model3.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.minuteInterval] handler:^(NSString * _Nullable newText) { + weakSelf.minuteInterval = [newText integerValue]; + }]; + }; [settings addObject:model3]; LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Date" detailTitle:[self LL_hierarchyObjectDescription:self.date]] noneInsets]; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h index cd26c42f..0c00b311 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h @@ -126,6 +126,8 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *_Nullable)datePickerModeDescription:(UIDatePickerMode)mode; ++ (NSArray *)datePickerModes; + + (NSString *_Nullable)barStyleDescription:(UIBarStyle)style; + (NSString *_Nullable)searchBarStyleDescription:(UISearchBarStyle)style; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m index 682d72ff..cb1d0236 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m @@ -730,6 +730,17 @@ + (NSString *)datePickerModeDescription:(UIDatePickerMode)mode { return nil; } ++ (NSArray *)datePickerModes { + NSMutableArray *modes = [[NSMutableArray alloc] init]; + for (UIDatePickerMode i = UIDatePickerModeDate; i <= UIDatePickerModeCountDownTimer; i++) { + NSString *mode = [self datePickerModeDescription:i]; + if (mode) { + [modes addObject:mode]; + } + } + return [modes copy]; +} + + (NSString *)barStyleDescription:(UIBarStyle)style { switch (style) { case UIBarStyleDefault: From 30d9cca7ce4eba1fc22cfa1c3c11236d97846e7b Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Tue, 29 Oct 2019 09:19:01 +0800 Subject: [PATCH 27/45] Dynamic UIDatePicker. --- .../Function/NSObject+LL_Hierarchy.m | 42 +++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index b2d9f144..9b720411 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -82,6 +82,13 @@ - (NSString *)LL_hierarchyObjectDescription:(NSObject *)obj { return text; } +- (NSString *)LL_hierarchyDateDescription:(NSDate *)date { + if (!date) { + return @""; + } + return [LLFormatterTool stringFromDate:date style:FormatterToolDateStyle3] ?: @""; +} + - (NSString *)LL_hierarchyTextDescription:(NSString *)text { if (text == nil) { return @""; @@ -1804,21 +1811,42 @@ @implementation UIDatePicker (LL_Hierarchy) }; [settings addObject:model3]; - LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Date" detailTitle:[self LL_hierarchyObjectDescription:self.date]] noneInsets]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Date" detailTitle:[self LL_hierarchyDateDescription:self.date]] noneInsets]; + model4.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool stringFromDate:weakSelf.date style:FormatterToolDateStyle3] handler:^(NSString * _Nullable newText) { + NSDate *newDate = [LLFormatterTool dateFromString:newText style:FormatterToolDateStyle3]; + if (newDate) { + weakSelf.date = newDate; + } + }]; + }; [settings addObject:model4]; - LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Date" detailTitle:[self LL_hierarchyObjectDescription:self.minimumDate]] noneInsets]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Date" detailTitle:[self LL_hierarchyDateDescription:self.minimumDate]] noneInsets]; + model5.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool stringFromDate:weakSelf.minimumDate style:FormatterToolDateStyle3] handler:^(NSString * _Nullable newText) { + NSDate *newDate = [LLFormatterTool dateFromString:newText style:FormatterToolDateStyle3]; + if (newDate) { + weakSelf.minimumDate = newDate; + } + }]; + }; [settings addObject:model5]; - LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Max Date" detailTitle:[self LL_hierarchyObjectDescription:self.maximumDate]]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Max Date" detailTitle:[self LL_hierarchyDateDescription:self.maximumDate]]; + model6.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool stringFromDate:weakSelf.maximumDate style:FormatterToolDateStyle3] handler:^(NSString * _Nullable newText) { + NSDate *newDate = [LLFormatterTool dateFromString:newText style:FormatterToolDateStyle3]; + if (newDate) { + weakSelf.maximumDate = newDate; + } + }]; + }; [settings addObject:model6]; - LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Count Down" detailTitle:[LLFormatterTool formatNumber:@(self.countDownDuration)]] noneInsets]; + LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:@"Count Down" detailTitle:[LLFormatterTool formatNumber:@(self.countDownDuration)]]; [settings addObject:model7]; - LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Count Down in Seconds"]; - [settings addObject:model8]; - LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Date Picker" items:settings]; NSMutableArray *models = [[NSMutableArray alloc] initWithArray:[super LL_hierarchyCategoryModels]]; From d91fb90d13908166d42ed81a28fea5152dec95f1 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Tue, 29 Oct 2019 09:56:29 +0800 Subject: [PATCH 28/45] Dynamic UINavigationBar. --- .../Function/NSObject+LL_Hierarchy.m | 42 +++++++++++++++++-- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 9b720411..e6b8b9f4 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -1884,16 +1884,26 @@ @implementation UIPickerView (LL_Hierarchy) @implementation UINavigationBar (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self)weakSelf = self; + NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription barStyleDescription:self.barStyle]] noneInsets]; [settings addObject:model1]; - LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]]] noneInsets]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]] flag:self.isTranslucent] noneInsets]; + model2.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.translucent = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model2]; if (@available(iOS 11.0, *)) { - LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Prefers Large Titles %@",[self LL_hierarchyBoolDescription:self.prefersLargeTitles]]] noneInsets]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Prefers Large Titles %@",[self LL_hierarchyBoolDescription:self.prefersLargeTitles]] flag:self.prefersLargeTitles] noneInsets]; + model3.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.prefersLargeTitles = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model3]; } @@ -1912,7 +1922,20 @@ @implementation UINavigationBar (LL_Hierarchy) LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Title Attr." detailTitle:nil] noneInsets]; [settings addObject:model8]; - LLTitleCellModel *model9 = [[[LLTitleCellModel alloc] initWithTitle:@"Title Font" detailTitle:[self LL_hierarchyColorDescription:self.titleTextAttributes[NSFontAttributeName]]] noneInsets]; + LLTitleCellModel *model9 = [[[LLTitleCellModel alloc] initWithTitle:@"Title Font" detailTitle:[self LL_hierarchyObjectDescription:self.titleTextAttributes[NSFontAttributeName]]] noneInsets]; + if (self.titleTextAttributes[NSFontAttributeName]) { + model9.block = ^{ + __block UIFont *font = weakSelf.titleTextAttributes[NSFontAttributeName]; + if (!font) { + return; + } + [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(font.pointSize)]] handler:^(NSString * _Nullable newText) { + NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithDictionary:weakSelf.titleTextAttributes]; + attributes[NSFontAttributeName] = [font fontWithSize:[newText doubleValue]]; + weakSelf.titleTextAttributes = [attributes copy]; + }]; + }; + } [settings addObject:model9]; LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Title Color" detailTitle:[self LL_hierarchyColorDescription:self.titleTextAttributes[NSForegroundColorAttributeName]]] noneInsets]; @@ -1934,6 +1957,19 @@ @implementation UINavigationBar (LL_Hierarchy) [settings addObject:model13]; LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:@"Title Font" detailTitle:[self LL_hierarchyColorDescription:self.largeTitleTextAttributes[NSFontAttributeName]]] noneInsets]; + if (self.largeTitleTextAttributes[NSFontAttributeName]) { + model14.block = ^{ + __block UIFont *font = weakSelf.largeTitleTextAttributes[NSFontAttributeName]; + if (!font) { + return; + } + [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(font.pointSize)]] handler:^(NSString * _Nullable newText) { + NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithDictionary:weakSelf.largeTitleTextAttributes]; + attributes[NSFontAttributeName] = [font fontWithSize:[newText doubleValue]]; + weakSelf.largeTitleTextAttributes = [attributes copy]; + }]; + }; + } [settings addObject:model14]; LLTitleCellModel *model15 = [[[LLTitleCellModel alloc] initWithTitle:@"Title Color" detailTitle:[self LL_hierarchyColorDescription:self.largeTitleTextAttributes[NSForegroundColorAttributeName]]] noneInsets]; From 11b53cfec22f21c0cc6e0c13eb37c24735a8d06d Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Tue, 29 Oct 2019 09:59:16 +0800 Subject: [PATCH 29/45] Dynamic UINavigationBar. --- .../Hierarchy/Function/NSObject+LL_Hierarchy.m | 5 +++++ .../Core/Others/EnumDescription/LLEnumDescription.h | 2 ++ .../Core/Others/EnumDescription/LLEnumDescription.m | 11 +++++++++++ 3 files changed, 18 insertions(+) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index e6b8b9f4..f2d5782d 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -1889,6 +1889,11 @@ @implementation UINavigationBar (LL_Hierarchy) NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription barStyleDescription:self.barStyle]] noneInsets]; + model1.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription barStyles] currentAction:[LLEnumDescription barStyleDescription:weakSelf.barStyle] completion:^(NSInteger index) { + weakSelf.barStyle = index; + }]; + }; [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]] flag:self.isTranslucent] noneInsets]; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h index 0c00b311..7999b926 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h @@ -130,6 +130,8 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *_Nullable)barStyleDescription:(UIBarStyle)style; ++ (NSArray *)barStyles; + + (NSString *_Nullable)searchBarStyleDescription:(UISearchBarStyle)style; + (NSString *_Nullable)tabBarItemPositioningDescription:(UITabBarItemPositioning)positioning; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m index cb1d0236..ef7a63a7 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m @@ -756,6 +756,17 @@ + (NSString *)barStyleDescription:(UIBarStyle)style { return nil; } ++ (NSArray *)barStyles { + NSMutableArray *styles = [[NSMutableArray alloc] init]; + for (UIBarStyle i = UIBarStyleDefault; i <= UIBarStyleBlackTranslucent; i++) { + NSString *style = [self barStyleDescription:i]; + if (style) { + [styles addObject:style]; + } + } + return [styles copy]; +} + + (NSString *)searchBarStyleDescription:(UISearchBarStyle)style { switch (style) { case UISearchBarStyleDefault: From 3275d486297b4ba0233a37fc28d9dcfcbf6cf06f Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Tue, 29 Oct 2019 10:04:29 +0800 Subject: [PATCH 30/45] Dynamic UIToolbar. --- .../Hierarchy/Function/NSObject+LL_Hierarchy.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index f2d5782d..c2a7f92a 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -2008,12 +2008,23 @@ @implementation UINavigationBar (LL_Hierarchy) @implementation UIToolbar (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self) weakSelf = self; + NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription barStyleDescription:self.barStyle]] noneInsets]; + model1.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription barStyles] currentAction:[LLEnumDescription barStyleDescription:weakSelf.barStyle] completion:^(NSInteger index) { + weakSelf.barStyle = index; + }]; + }; [settings addObject:model1]; - LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]]] noneInsets]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]] flag:self.isTranslucent] noneInsets]; + model2.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.translucent = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model2]; LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Bar Tint" detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; From f3feedaa6c2665e66cb9ede2cc39f28614d6da84 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Tue, 29 Oct 2019 10:14:33 +0800 Subject: [PATCH 31/45] Dynamic UITabBar. --- .../Function/NSObject+LL_Hierarchy.m | 27 ++++++++++++++++++- .../EnumDescription/LLEnumDescription.h | 2 ++ .../EnumDescription/LLEnumDescription.m | 11 ++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index c2a7f92a..2657f723 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -2046,6 +2046,7 @@ @implementation UIToolbar (LL_Hierarchy) @implementation UITabBar (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self) weakSelf = self; NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Background" detailTitle:[self LL_hierarchyImageDescription:self.backgroundImage]] noneInsets]; @@ -2058,21 +2059,45 @@ @implementation UITabBar (LL_Hierarchy) [settings addObject:model3]; LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription barStyleDescription:self.barStyle]] noneInsets]; + model4.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription barStyles] currentAction:[LLEnumDescription barStyleDescription:weakSelf.barStyle] completion:^(NSInteger index) { + weakSelf.barStyle = index; + }]; + }; [settings addObject:model4]; - LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]]] noneInsets]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]] flag:self.isTranslucent] noneInsets]; + model5.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.translucent = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model5]; LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Bar Tint" detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; [settings addObject:model6]; LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription tabBarItemPositioningDescription:self.itemPositioning]] noneInsets]; + model7.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription tabBarItemPositionings] currentAction:[LLEnumDescription tabBarItemPositioningDescription:weakSelf.itemPositioning] completion:^(NSInteger index) { + weakSelf.itemPositioning = index; + }]; + }; [settings addObject:model7]; LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Item Width" detailTitle:[LLFormatterTool formatNumber:@(self.itemWidth)]] noneInsets]; + model8.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.itemWidth)] handler:^(NSString * _Nullable newText) { + weakSelf.itemWidth = [newText doubleValue]; + }]; + }; [settings addObject:model8]; LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Item Spacing" detailTitle:[LLFormatterTool formatNumber:@(self.itemSpacing)]]; + model9.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.itemSpacing)] handler:^(NSString * _Nullable newText) { + weakSelf.itemSpacing = [newText doubleValue]; + }]; + }; [settings addObject:model9]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Tab Bar" items:settings]; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h index 7999b926..ce610d3e 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h @@ -136,6 +136,8 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *_Nullable)tabBarItemPositioningDescription:(UITabBarItemPositioning)positioning; ++ (NSArray *)tabBarItemPositionings; + @end NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m index ef7a63a7..c5d58685 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m @@ -791,4 +791,15 @@ + (NSString *)tabBarItemPositioningDescription:(UITabBarItemPositioning)position return nil; } ++ (NSArray *)tabBarItemPositionings { + NSMutableArray *positionings = [[NSMutableArray alloc] init]; + for (UITabBarItemPositioning i = UITabBarItemPositioningAutomatic; i <= UITabBarItemPositioningCentered; i++) { + NSString *positioning = [self tabBarItemPositioningDescription:i]; + if (positioning) { + [positionings addObject:positioning]; + } + } + return [positionings copy]; +} + @end From ba07a893abb6d0d5ce2f4f1ae235724f3736da56 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Tue, 29 Oct 2019 10:27:22 +0800 Subject: [PATCH 32/45] Dynamic UISearchBar. --- .../Function/NSObject+LL_Hierarchy.m | 71 +++++++++++++++++-- .../EnumDescription/LLEnumDescription.h | 2 + .../EnumDescription/LLEnumDescription.m | 15 +++- 3 files changed, 81 insertions(+), 7 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 2657f723..9bc351b1 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -2116,24 +2116,54 @@ @implementation UITabBar (LL_Hierarchy) @implementation UISearchBar (LL_Hierarchy) - (NSArray *)LL_hierarchyCategoryModels { + __weak typeof(self) weakSelf = self; NSMutableArray *settings = [[NSMutableArray alloc] init]; LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Text" detailTitle:[self LL_hierarchyTextDescription:self.text]] noneInsets]; + model1.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.text handler:^(NSString * _Nullable newText) { + weakSelf.text = newText; + }]; + }; [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Placeholder" detailTitle:[self LL_hierarchyTextDescription:self.placeholder]] noneInsets]; + model2.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.placeholder handler:^(NSString * _Nullable newText) { + weakSelf.placeholder = newText; + }]; + }; [settings addObject:model2]; LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Prompt" detailTitle:[self LL_hierarchyTextDescription:self.prompt]]; + model3.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.prompt handler:^(NSString * _Nullable newText) { + weakSelf.prompt = newText; + }]; + }; [settings addObject:model3]; LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Search Style" detailTitle:[LLEnumDescription searchBarStyleDescription:self.searchBarStyle]] noneInsets]; + model4.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription searchBarStyles] currentAction:[LLEnumDescription searchBarStyleDescription:weakSelf.searchBarStyle] completion:^(NSInteger index) { + weakSelf.searchBarStyle = index; + }]; + }; [settings addObject:model4]; LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Bar Style" detailTitle:[LLEnumDescription barStyleDescription:self.barStyle]] noneInsets]; + model5.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription barStyles] currentAction:[LLEnumDescription barStyleDescription:weakSelf.barStyle] completion:^(NSInteger index) { + weakSelf.barStyle = index; + }]; + }; [settings addObject:model5]; - LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]]] noneInsets]; + LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]] flag:self.isTranslucent] noneInsets]; + model6.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.translucent = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model6]; LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; @@ -2151,28 +2181,59 @@ @implementation UISearchBar (LL_Hierarchy) LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:@"BG Offset" detailTitle:[self LL_hierarchyOffsetDescription:self.searchFieldBackgroundPositionAdjustment]]; [settings addObject:model11]; - LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Options" detailTitle:[NSString stringWithFormat:@"Shows Search Results Button %@",[self LL_hierarchyBoolDescription:self.showsSearchResultsButton]]] noneInsets]; + LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Options" detailTitle:[NSString stringWithFormat:@"Shows Search Results Button %@",[self LL_hierarchyBoolDescription:self.showsSearchResultsButton]] flag:self.showsSearchResultsButton] noneInsets]; + model12.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.showsSearchResultsButton = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model12]; - LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Bookmarks Button %@",[self LL_hierarchyBoolDescription:self.showsBookmarkButton]]] noneInsets]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Bookmarks Button %@",[self LL_hierarchyBoolDescription:self.showsBookmarkButton]] flag:self.showsBookmarkButton] noneInsets]; + model13.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.showsBookmarkButton = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model13]; - LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Cancel Button %@",[self LL_hierarchyBoolDescription:self.showsCancelButton]]] noneInsets]; + LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Cancel Button %@",[self LL_hierarchyBoolDescription:self.showsCancelButton]] flag:self.showsCancelButton] noneInsets]; + model14.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.showsCancelButton = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model14]; - LLTitleCellModel *model15 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Scope Bar %@",[self LL_hierarchyBoolDescription:self.showsScopeBar]]]; + LLTitleCellModel *model15 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Scope Bar %@",[self LL_hierarchyBoolDescription:self.showsScopeBar]] flag:self.showsScopeBar]; + model15.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.showsScopeBar = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model15]; LLTitleCellModel *model16 = [[LLTitleCellModel alloc] initWithTitle:@"Scope Titles" detailTitle:[self LL_hierarchyObjectDescription:self.scopeButtonTitles]]; [settings addObject:model16]; LLTitleCellModel *model17 = [[[LLTitleCellModel alloc] initWithTitle:@"Capitalization" detailTitle:[LLEnumDescription textAutocapitalizationTypeDescription:self.autocapitalizationType]] noneInsets]; + model17.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription textAutocapitalizationTypes] currentAction:[LLEnumDescription textAutocapitalizationTypeDescription:weakSelf.autocapitalizationType] completion:^(NSInteger index) { + weakSelf.autocapitalizationType = index; + }]; + }; [settings addObject:model17]; LLTitleCellModel *model18 = [[[LLTitleCellModel alloc] initWithTitle:@"Correction" detailTitle:[LLEnumDescription textAutocorrectionTypeDescription:self.autocorrectionType]] noneInsets]; + model18.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription textAutocorrectionTypes] currentAction:[LLEnumDescription textAutocorrectionTypeDescription:weakSelf.autocorrectionType] completion:^(NSInteger index) { + weakSelf.autocorrectionType = index; + }]; + }; [settings addObject:model18]; LLTitleCellModel *model19 = [[LLTitleCellModel alloc] initWithTitle:@"Keyboard" detailTitle:[LLEnumDescription keyboardTypeDescription:self.keyboardType]]; + model19.block = ^{ + [weakSelf LL_showActionSheetWithActions:[LLEnumDescription keyboardTypes] currentAction:[LLEnumDescription keyboardTypeDescription:weakSelf.keyboardType] completion:^(NSInteger index) { + weakSelf.keyboardType = index; + }]; + }; [settings addObject:model19]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Search Bar" items:settings]; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h index ce610d3e..85d4d6e4 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h @@ -134,6 +134,8 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *_Nullable)searchBarStyleDescription:(UISearchBarStyle)style; ++ (NSArray *)searchBarStyles; + + (NSString *_Nullable)tabBarItemPositioningDescription:(UITabBarItemPositioning)positioning; + (NSArray *)tabBarItemPositionings; diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m index c5d58685..71f9ac79 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m @@ -771,14 +771,25 @@ + (NSString *)searchBarStyleDescription:(UISearchBarStyle)style { switch (style) { case UISearchBarStyleDefault: return @"Default"; - case UISearchBarStyleMinimal: - return @"Minimal"; case UISearchBarStyleProminent: return @"Prominent"; + case UISearchBarStyleMinimal: + return @"Minimal"; } return nil; } ++ (NSArray *)searchBarStyles { + NSMutableArray *styles = [[NSMutableArray alloc] init]; + for (UISearchBarStyle i = UISearchBarStyleDefault; i <= UISearchBarStyleMinimal; i++) { + NSString *style = [self searchBarStyleDescription:i]; + if (style) { + [styles addObject:style]; + } + } + return [styles copy]; +} + + (NSString *)tabBarItemPositioningDescription:(UITabBarItemPositioning)positioning { switch (positioning) { case UITabBarItemPositioningAutomatic: From c01385bcc71e6f4618952bcb7474815a1d76b3ec Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Tue, 29 Oct 2019 10:54:32 +0800 Subject: [PATCH 33/45] Update NSObject+LL_Hierarchy.m --- .../Function/NSObject+LL_Hierarchy.m | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 9bc351b1..bd7b99ce 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -207,7 +207,7 @@ @implementation UIView (LL_Hierarchy) }; [settings addObject:model5]; - LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Multiple Touch" flag:self.isMultipleTouchEnabled]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Multiple Touch %@", [self LL_hierarchyBoolDescription:self.isMultipleTouchEnabled]] flag:self.isMultipleTouchEnabled]; model6.changePropertyBlock = ^(id _Nullable obj) { weakSelf.multipleTouchEnabled = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -228,35 +228,35 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Tint" detailTitle:[self LL_hierarchyColorDescription:self.tintColor]]; [settings addObject:model9]; - LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Opaque" flag:self.isOpaque] noneInsets]; + LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Drawing" detailTitle:[NSString stringWithFormat:@"Opaque %@",[self LL_hierarchyBoolDescription:self.isOpaque]] flag:self.isOpaque] noneInsets]; model10.changePropertyBlock = ^(id _Nullable obj) { weakSelf.opaque = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model10]; - LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:@"Hidden" flag:self.isHidden] noneInsets]; + LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Hidden %@",[self LL_hierarchyBoolDescription:self.isHidden]] flag:self.isHidden] noneInsets]; model11.changePropertyBlock = ^(id _Nullable obj) { weakSelf.hidden = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model11]; - LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Clears Graphics Context" flag:self.clearsContextBeforeDrawing] noneInsets]; + LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clears Graphics Context %@",[self LL_hierarchyBoolDescription:self.clearsContextBeforeDrawing]] flag:self.clearsContextBeforeDrawing] noneInsets]; model12.changePropertyBlock = ^(id _Nullable obj) { weakSelf.clearsContextBeforeDrawing = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model12]; - LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:@"Clip To Bounds" flag:self.clipsToBounds] noneInsets]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clip To Bounds %@",[self LL_hierarchyBoolDescription:self.clipsToBounds]] flag:self.clipsToBounds] noneInsets]; model13.changePropertyBlock = ^(id _Nullable obj) { weakSelf.clipsToBounds = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model13]; - LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:@"Autoresizes Subviews" flag:self.autoresizesSubviews]; + LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Autoresizes Subviews %@", [self LL_hierarchyBoolDescription:self.autoresizesSubviews]] flag:self.autoresizesSubviews]; model14.changePropertyBlock = ^(id _Nullable obj) { weakSelf.autoresizesSubviews = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -343,14 +343,14 @@ @implementation UILabel (LL_Hierarchy) }; [settings addObject:model6]; - LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Enabled" flag:self.isEnabled] noneInsets]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Enabled %@",[self LL_hierarchyBoolDescription:self.isEnabled]] flag:self.isEnabled] noneInsets]; model7.changePropertyBlock = ^(id _Nullable obj) { weakSelf.enabled = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model7]; - LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:@"Highlighted" flag:self.isHighlighted]; + LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Highlighted %@", [self LL_hierarchyBoolDescription:self.isHighlighted]] flag:self.isHighlighted]; model8.changePropertyBlock = ^(id _Nullable obj) { weakSelf.highlighted = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -431,21 +431,21 @@ @implementation UIControl (LL_Hierarchy) }; [settings addObject:model2]; - LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Select" flag:self.isSelected] noneInsets]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Content" detailTitle:self.isSelected ? @"Selected" : @"Not Selected" flag:self.isSelected] noneInsets]; model3.changePropertyBlock = ^(id _Nullable obj) { weakSelf.selected = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model3]; - LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Enable" flag:self.isEnabled] noneInsets]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:self.isEnabled ? @"Enabled" : @"Not Enabled" flag:self.isEnabled] noneInsets]; model4.changePropertyBlock = ^(id _Nullable obj) { weakSelf.enabled = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model4]; - LLTitleCellModel *model5 = [[LLTitleCellModel alloc] initWithTitle:@"Highlight" flag:self.isHighlighted]; + LLTitleCellModel *model5 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:self.isHighlighted ? @"Highlighted" : @"Not Highlighted" flag:self.isHighlighted]; model5.changePropertyBlock = ^(id _Nullable obj) { weakSelf.highlighted = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -594,7 +594,7 @@ @implementation UIImageView (LL_Hierarchy) LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Highlighted" detailTitle: [self LL_hierarchyImageDescription:self.highlightedImage]]; [settings addObject:model2]; - LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Highlight" flag:self.isHighlighted]; + LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"State" detailTitle:self.isHighlighted ? @"Highlighted" : @"Not Highlighted" flag:self.isHighlighted]; model3.changePropertyBlock = ^(id _Nullable obj) { weakSelf.highlighted = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -693,7 +693,7 @@ @implementation UITextField (LL_Hierarchy) }; [settings addObject:model11]; - LLTitleCellModel *model12 = [[LLTitleCellModel alloc] initWithTitle:@"Clear on edit" flag:self.clearsOnBeginEditing]; + LLTitleCellModel *model12 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clear when editing begins %@", [self LL_hierarchyBoolDescription:self.clearsOnBeginEditing]] flag:self.clearsOnBeginEditing]; model12.changePropertyBlock = ^(id _Nullable obj) { weakSelf.clearsOnBeginEditing = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -708,7 +708,7 @@ @implementation UITextField (LL_Hierarchy) }; [settings addObject:model13]; - LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:@"Adjust font size" flag:self.adjustsFontSizeToFitWidth]; + LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Adjusts to Fit %@",[self LL_hierarchyBoolDescription:self.adjustsFontSizeToFitWidth]] flag:self.adjustsFontSizeToFitWidth]; model14.changePropertyBlock = ^(id _Nullable obj) { weakSelf.adjustsFontSizeToFitWidth = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -758,7 +758,7 @@ @implementation UITextField (LL_Hierarchy) LLTitleCellModel *model20 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Auto-enable Return Key %@", [self LL_hierarchyBoolDescription:self.enablesReturnKeyAutomatically]]] noneInsets]; [settings addObject:model20]; - LLTitleCellModel *model21 = [[LLTitleCellModel alloc] initWithTitle:@"Secure Entry" flag:self.isSecureTextEntry]; + LLTitleCellModel *model21 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Secure Entry %@",[self LL_hierarchyBoolDescription:self.isSecureTextEntry]] flag:self.isSecureTextEntry]; model21.changePropertyBlock = ^(id _Nullable obj) { weakSelf.secureTextEntry = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -785,7 +785,7 @@ @implementation UISegmentedControl (LL_Hierarchy) NSMutableArray *settings = [[NSMutableArray alloc] init]; - LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Momentary" flag:self.isMomentary] noneInsets]; + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:self.isMomentary ? @"Momentary" : @"Persistent Selection" flag:self.isMomentary] noneInsets]; model1.changePropertyBlock = ^(id _Nullable obj) { weakSelf.momentary = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -828,7 +828,7 @@ @implementation UISegmentedControl (LL_Hierarchy) LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Offset" detailTitle:[self LL_hierarchySizeDescription:[self contentOffsetForSegmentAtIndex:self.selectedSegmentIndex]]] noneInsets]; [settings addObject:model7]; - LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Apportions segment width" flag:self.apportionsSegmentWidthsByContent] noneInsets]; + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Size Mode" detailTitle:self.apportionsSegmentWidthsByContent ? @"Proportional to Content" : @"Equal Widths" flag:self.apportionsSegmentWidthsByContent] noneInsets]; model8.changePropertyBlock = ^(id _Nullable obj) { weakSelf.apportionsSegmentWidthsByContent = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -896,7 +896,7 @@ @implementation UISlider (LL_Hierarchy) LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:@"Thumb Tint" detailTitle:[self LL_hierarchyColorDescription:self.tintColor]]; [settings addObject:model8]; - LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Continuous" flag:self.isContinuous]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Events" detailTitle:[NSString stringWithFormat:@"Continuous Update %@", [self LL_hierarchyBoolDescription:self.isContinuous]] flag:self.isContinuous]; model9.changePropertyBlock = ^(id _Nullable obj) { weakSelf.continuous = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -971,7 +971,7 @@ @implementation UIActivityIndicatorView (LL_Hierarchy) LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.color]] noneInsets]; [settings addObject:model2]; - LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Animating" flag:self.isAnimating] noneInsets]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Animating %@", [self LL_hierarchyBoolDescription:self.isAnimating]] flag:self.isAnimating] noneInsets]; model3.changePropertyBlock = ^(id _Nullable obj) { if ([obj boolValue]) { if (!weakSelf.isAnimating) { @@ -986,7 +986,7 @@ @implementation UIActivityIndicatorView (LL_Hierarchy) }; [settings addObject:model3]; - LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:@"Hides When Stopped" flag:self.hidesWhenStopped]; + LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Hides When Stopped %@", [self LL_hierarchyBoolDescription:self.hidesWhenStopped]] flag:self.hidesWhenStopped]; model4.changePropertyBlock = ^(id _Nullable obj) { weakSelf.hidesWhenStopped = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -1150,21 +1150,21 @@ @implementation UIStepper (LL_Hierarchy) }; [settings addObject:model4]; - LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Autorepeat" flag:self.autorepeat] noneInsets]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Autorepeat %@",[self LL_hierarchyBoolDescription:self.autorepeat]] flag:self.autorepeat] noneInsets]; model5.changePropertyBlock = ^(id _Nullable obj) { weakSelf.autorepeat = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model5]; - LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Continuous" flag:self.isContinuous] noneInsets]; + LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Continuous %@",[self LL_hierarchyBoolDescription:self.isContinuous]] flag:self.isContinuous] noneInsets]; model6.changePropertyBlock = ^(id _Nullable obj) { weakSelf.continuous = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model6]; - LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:@"Wrap" flag:self.wraps]; + LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Wrap %@",[self LL_hierarchyBoolDescription:self.wraps]] flag:self.wraps]; model7.changePropertyBlock = ^(id _Nullable obj) { weakSelf.wraps = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -1199,56 +1199,56 @@ @implementation UIScrollView (LL_Hierarchy) }; [settings addObject:model1]; - LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Shows Horizontal Indicator" flag:self.showsHorizontalScrollIndicator] noneInsets]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Indicators" detailTitle:[NSString stringWithFormat:@"Shows Horizontal Indicator %@",[self LL_hierarchyBoolDescription:self.showsHorizontalScrollIndicator]] flag:self.showsHorizontalScrollIndicator] noneInsets]; model2.changePropertyBlock = ^(id _Nullable obj) { weakSelf.showsHorizontalScrollIndicator = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model2]; - LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Shows Vertical Indicator" flag:self.showsVerticalScrollIndicator]; + LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Vertical Indicator %@",[self LL_hierarchyBoolDescription:self.showsVerticalScrollIndicator]] flag:self.showsVerticalScrollIndicator]; model3.changePropertyBlock = ^(id _Nullable obj) { weakSelf.showsVerticalScrollIndicator = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model3]; - LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Scroll enable" flag:self.isScrollEnabled] noneInsets]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Scrolling" detailTitle:[NSString stringWithFormat:@"Scrolling %@", self.isScrollEnabled ? @"Enabled" : @"Not Enabled"] flag:self.isScrollEnabled] noneInsets]; model4.changePropertyBlock = ^(id _Nullable obj) { weakSelf.scrollEnabled = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model4]; - LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Page enable" flag:self.isPagingEnabled] noneInsets]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Paging %@", self.isPagingEnabled ? @"Enabled" : @"Disabled"] flag:self.isPagingEnabled] noneInsets]; model5.changePropertyBlock = ^(id _Nullable obj) { weakSelf.pagingEnabled = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model5]; - LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Direction lock enable" flag:weakSelf.isDirectionalLockEnabled]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Direction Lock %@",self.isDirectionalLockEnabled ? @"Enabled" : @"Disabled"] flag:self.isDirectionalLockEnabled]; model6.changePropertyBlock = ^(id _Nullable obj) { weakSelf.directionalLockEnabled = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model6]; - LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Bounce" flag:self.bounces] noneInsets]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Bounce" detailTitle:[NSString stringWithFormat:@"Bounces %@",[self LL_hierarchyBoolDescription:self.bounces]] flag:self.bounces] noneInsets]; model7.changePropertyBlock = ^(id _Nullable obj) { weakSelf.bounces = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model7]; - LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Bounce Horizontal" flag:self.alwaysBounceHorizontal] noneInsets]; + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Bounce Horizontal %@",[self LL_hierarchyBoolDescription:self.alwaysBounceHorizontal]] flag:self.alwaysBounceHorizontal] noneInsets]; model8.changePropertyBlock = ^(id _Nullable obj) { weakSelf.alwaysBounceHorizontal = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model8]; - LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Bounce Vertical" flag:self.alwaysBounceVertical]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Bounce Vertical %@",[self LL_hierarchyBoolDescription:self.alwaysBounceVertical]] flag:self.alwaysBounceVertical]; model9.changePropertyBlock = ^(id _Nullable obj) { weakSelf.alwaysBounceVertical = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -1274,14 +1274,14 @@ @implementation UIScrollView (LL_Hierarchy) LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Touch" detailTitle:[NSString stringWithFormat:@"Zoom Bounces %@",[self LL_hierarchyBoolDescription:self.isZoomBouncing]]] noneInsets]; [settings addObject:model12]; - LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:@"Delays Content Touches" flag:self.delaysContentTouches] noneInsets]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Delays Content Touches %@",[self LL_hierarchyBoolDescription:self.delaysContentTouches]] flag:self.delaysContentTouches] noneInsets]; model13.changePropertyBlock = ^(id _Nullable obj) { weakSelf.delaysContentTouches = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model13]; - LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:@"Cancellable Content Touches" flag:self.canCancelContentTouches]; + LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Cancellable Content Touches %@",[self LL_hierarchyBoolDescription:self.canCancelContentTouches]] flag:self.canCancelContentTouches]; model14.changePropertyBlock = ^(id _Nullable obj) { weakSelf.canCancelContentTouches = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; From 49919593aa10c452199c258e3e291ef1a01a2948 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Tue, 29 Oct 2019 11:24:24 +0800 Subject: [PATCH 34/45] Dynamic properties. --- .../Function/NSObject+LL_Hierarchy.m | 124 ++++++++++-------- .../View/TitleCell/LLTitleSwitchCell.m | 4 +- 2 files changed, 72 insertions(+), 56 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index bd7b99ce..83fb8750 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -207,7 +207,7 @@ @implementation UIView (LL_Hierarchy) }; [settings addObject:model5]; - LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Multiple Touch %@", [self LL_hierarchyBoolDescription:self.isMultipleTouchEnabled]] flag:self.isMultipleTouchEnabled]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Multiple Touch" flag:self.isMultipleTouchEnabled]; model6.changePropertyBlock = ^(id _Nullable obj) { weakSelf.multipleTouchEnabled = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -228,35 +228,35 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Tint" detailTitle:[self LL_hierarchyColorDescription:self.tintColor]]; [settings addObject:model9]; - LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Drawing" detailTitle:[NSString stringWithFormat:@"Opaque %@",[self LL_hierarchyBoolDescription:self.isOpaque]] flag:self.isOpaque] noneInsets]; + LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Drawing" detailTitle:@"Opaque" flag:self.isOpaque] noneInsets]; model10.changePropertyBlock = ^(id _Nullable obj) { weakSelf.opaque = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model10]; - LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Hidden %@",[self LL_hierarchyBoolDescription:self.isHidden]] flag:self.isHidden] noneInsets]; + LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Hidden" flag:self.isHidden] noneInsets]; model11.changePropertyBlock = ^(id _Nullable obj) { weakSelf.hidden = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model11]; - LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clears Graphics Context %@",[self LL_hierarchyBoolDescription:self.clearsContextBeforeDrawing]] flag:self.clearsContextBeforeDrawing] noneInsets]; + LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Clears Graphics Context" flag:self.clearsContextBeforeDrawing] noneInsets]; model12.changePropertyBlock = ^(id _Nullable obj) { weakSelf.clearsContextBeforeDrawing = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model12]; - LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clip To Bounds %@",[self LL_hierarchyBoolDescription:self.clipsToBounds]] flag:self.clipsToBounds] noneInsets]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Clip To Bounds" flag:self.clipsToBounds] noneInsets]; model13.changePropertyBlock = ^(id _Nullable obj) { weakSelf.clipsToBounds = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model13]; - LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Autoresizes Subviews %@", [self LL_hierarchyBoolDescription:self.autoresizesSubviews]] flag:self.autoresizesSubviews]; + LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Autoresizes Subviews" flag:self.autoresizesSubviews]; model14.changePropertyBlock = ^(id _Nullable obj) { weakSelf.autoresizesSubviews = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -343,14 +343,14 @@ @implementation UILabel (LL_Hierarchy) }; [settings addObject:model6]; - LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Enabled %@",[self LL_hierarchyBoolDescription:self.isEnabled]] flag:self.isEnabled] noneInsets]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:@"Enabled" flag:self.isEnabled] noneInsets]; model7.changePropertyBlock = ^(id _Nullable obj) { weakSelf.enabled = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model7]; - LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Highlighted %@", [self LL_hierarchyBoolDescription:self.isHighlighted]] flag:self.isHighlighted]; + LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Highlighted" flag:self.isHighlighted]; model8.changePropertyBlock = ^(id _Nullable obj) { weakSelf.highlighted = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -637,7 +637,11 @@ @implementation UITextField (LL_Hierarchy) }; [settings addObject:model2]; - LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Allows Editing Attributes %@", [self LL_hierarchyBoolDescription:self.allowsEditingTextAttributes]]] noneInsets]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Allows Editing Attributes" flag:self.allowsEditingTextAttributes] noneInsets]; + model3.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.allowsEditingTextAttributes = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model3]; LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.textColor]] noneInsets]; @@ -693,7 +697,7 @@ @implementation UITextField (LL_Hierarchy) }; [settings addObject:model11]; - LLTitleCellModel *model12 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Clear when editing begins %@", [self LL_hierarchyBoolDescription:self.clearsOnBeginEditing]] flag:self.clearsOnBeginEditing]; + LLTitleCellModel *model12 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Clear when editing begins" flag:self.clearsOnBeginEditing]; model12.changePropertyBlock = ^(id _Nullable obj) { weakSelf.clearsOnBeginEditing = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -708,7 +712,7 @@ @implementation UITextField (LL_Hierarchy) }; [settings addObject:model13]; - LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Adjusts to Fit %@",[self LL_hierarchyBoolDescription:self.adjustsFontSizeToFitWidth]] flag:self.adjustsFontSizeToFitWidth]; + LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Adjusts to Fit" flag:self.adjustsFontSizeToFitWidth]; model14.changePropertyBlock = ^(id _Nullable obj) { weakSelf.adjustsFontSizeToFitWidth = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -755,10 +759,14 @@ @implementation UITextField (LL_Hierarchy) }; [settings addObject:model19]; - LLTitleCellModel *model20 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Auto-enable Return Key %@", [self LL_hierarchyBoolDescription:self.enablesReturnKeyAutomatically]]] noneInsets]; + LLTitleCellModel *model20 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Auto-enable Return Key" flag:self.enablesReturnKeyAutomatically] noneInsets]; + model20.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.enablesReturnKeyAutomatically = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model20]; - LLTitleCellModel *model21 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Secure Entry %@",[self LL_hierarchyBoolDescription:self.isSecureTextEntry]] flag:self.isSecureTextEntry]; + LLTitleCellModel *model21 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Secure Entry" flag:self.isSecureTextEntry]; model21.changePropertyBlock = ^(id _Nullable obj) { weakSelf.secureTextEntry = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -896,7 +904,7 @@ @implementation UISlider (LL_Hierarchy) LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:@"Thumb Tint" detailTitle:[self LL_hierarchyColorDescription:self.tintColor]]; [settings addObject:model8]; - LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Events" detailTitle:[NSString stringWithFormat:@"Continuous Update %@", [self LL_hierarchyBoolDescription:self.isContinuous]] flag:self.isContinuous]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Events" detailTitle:@"Continuous Update" flag:self.isContinuous]; model9.changePropertyBlock = ^(id _Nullable obj) { weakSelf.continuous = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -971,7 +979,7 @@ @implementation UIActivityIndicatorView (LL_Hierarchy) LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.color]] noneInsets]; [settings addObject:model2]; - LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Animating %@", [self LL_hierarchyBoolDescription:self.isAnimating]] flag:self.isAnimating] noneInsets]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:@"Animating" flag:self.isAnimating] noneInsets]; model3.changePropertyBlock = ^(id _Nullable obj) { if ([obj boolValue]) { if (!weakSelf.isAnimating) { @@ -986,7 +994,7 @@ @implementation UIActivityIndicatorView (LL_Hierarchy) }; [settings addObject:model3]; - LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Hides When Stopped %@", [self LL_hierarchyBoolDescription:self.hidesWhenStopped]] flag:self.hidesWhenStopped]; + LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Hides When Stopped" flag:self.hidesWhenStopped]; model4.changePropertyBlock = ^(id _Nullable obj) { weakSelf.hidesWhenStopped = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -1085,10 +1093,18 @@ @implementation UIPageControl (LL_Hierarchy) }; [settings addObject:model2]; - LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Hides for Single Page %@",[self LL_hierarchyBoolDescription:self.hidesForSinglePage]]] noneInsets]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:@"Hides for Single Page" flag:self.hidesForSinglePage] noneInsets]; + model3.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.hidesForSinglePage = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model3]; - LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Defers Page Display %@", [self LL_hierarchyBoolDescription:self.defersCurrentPageDisplay]]]; + LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Defers Page Display" flag:self.defersCurrentPageDisplay]; + model4.changePropertyBlock = ^(id _Nullable obj) { + weakSelf.defersCurrentPageDisplay = [obj boolValue]; + [weakSelf LL_postHierarchyChangeNotification]; + }; [settings addObject:model4]; LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Tint Color" detailTitle:[self LL_hierarchyColorDescription:self.pageIndicatorTintColor]] noneInsets]; @@ -1150,21 +1166,21 @@ @implementation UIStepper (LL_Hierarchy) }; [settings addObject:model4]; - LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Autorepeat %@",[self LL_hierarchyBoolDescription:self.autorepeat]] flag:self.autorepeat] noneInsets]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:@"Autorepeat" flag:self.autorepeat] noneInsets]; model5.changePropertyBlock = ^(id _Nullable obj) { weakSelf.autorepeat = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model5]; - LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Continuous %@",[self LL_hierarchyBoolDescription:self.isContinuous]] flag:self.isContinuous] noneInsets]; + LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Continuous" flag:self.isContinuous] noneInsets]; model6.changePropertyBlock = ^(id _Nullable obj) { weakSelf.continuous = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model6]; - LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Wrap %@",[self LL_hierarchyBoolDescription:self.wraps]] flag:self.wraps]; + LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Wrap" flag:self.wraps]; model7.changePropertyBlock = ^(id _Nullable obj) { weakSelf.wraps = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -1199,56 +1215,56 @@ @implementation UIScrollView (LL_Hierarchy) }; [settings addObject:model1]; - LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Indicators" detailTitle:[NSString stringWithFormat:@"Shows Horizontal Indicator %@",[self LL_hierarchyBoolDescription:self.showsHorizontalScrollIndicator]] flag:self.showsHorizontalScrollIndicator] noneInsets]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Indicators" detailTitle:@"Shows Horizontal Indicator" flag:self.showsHorizontalScrollIndicator] noneInsets]; model2.changePropertyBlock = ^(id _Nullable obj) { weakSelf.showsHorizontalScrollIndicator = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model2]; - LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Vertical Indicator %@",[self LL_hierarchyBoolDescription:self.showsVerticalScrollIndicator]] flag:self.showsVerticalScrollIndicator]; + LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Shows Vertical Indicator" flag:self.showsVerticalScrollIndicator]; model3.changePropertyBlock = ^(id _Nullable obj) { weakSelf.showsVerticalScrollIndicator = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model3]; - LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Scrolling" detailTitle:[NSString stringWithFormat:@"Scrolling %@", self.isScrollEnabled ? @"Enabled" : @"Not Enabled"] flag:self.isScrollEnabled] noneInsets]; + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Scrolling" detailTitle:@"Enable" flag:self.isScrollEnabled] noneInsets]; model4.changePropertyBlock = ^(id _Nullable obj) { weakSelf.scrollEnabled = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model4]; - LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Paging %@", self.isPagingEnabled ? @"Enabled" : @"Disabled"] flag:self.isPagingEnabled] noneInsets]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Paging" flag:self.isPagingEnabled] noneInsets]; model5.changePropertyBlock = ^(id _Nullable obj) { weakSelf.pagingEnabled = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model5]; - LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Direction Lock %@",self.isDirectionalLockEnabled ? @"Enabled" : @"Disabled"] flag:self.isDirectionalLockEnabled]; + LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Direction Lock" flag:self.isDirectionalLockEnabled]; model6.changePropertyBlock = ^(id _Nullable obj) { weakSelf.directionalLockEnabled = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model6]; - LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Bounce" detailTitle:[NSString stringWithFormat:@"Bounces %@",[self LL_hierarchyBoolDescription:self.bounces]] flag:self.bounces] noneInsets]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Bounce" detailTitle:@"Bounces" flag:self.bounces] noneInsets]; model7.changePropertyBlock = ^(id _Nullable obj) { weakSelf.bounces = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model7]; - LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Bounce Horizontal %@",[self LL_hierarchyBoolDescription:self.alwaysBounceHorizontal]] flag:self.alwaysBounceHorizontal] noneInsets]; + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Bounce Horizontal" flag:self.alwaysBounceHorizontal] noneInsets]; model8.changePropertyBlock = ^(id _Nullable obj) { weakSelf.alwaysBounceHorizontal = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model8]; - LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Bounce Vertical %@",[self LL_hierarchyBoolDescription:self.alwaysBounceVertical]] flag:self.alwaysBounceVertical]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Bounce Vertical" flag:self.alwaysBounceVertical]; model9.changePropertyBlock = ^(id _Nullable obj) { weakSelf.alwaysBounceVertical = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -1274,14 +1290,14 @@ @implementation UIScrollView (LL_Hierarchy) LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Touch" detailTitle:[NSString stringWithFormat:@"Zoom Bounces %@",[self LL_hierarchyBoolDescription:self.isZoomBouncing]]] noneInsets]; [settings addObject:model12]; - LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Delays Content Touches %@",[self LL_hierarchyBoolDescription:self.delaysContentTouches]] flag:self.delaysContentTouches] noneInsets]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Delays Content Touches" flag:self.delaysContentTouches] noneInsets]; model13.changePropertyBlock = ^(id _Nullable obj) { weakSelf.delaysContentTouches = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model13]; - LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Cancellable Content Touches %@",[self LL_hierarchyBoolDescription:self.canCancelContentTouches]] flag:self.canCancelContentTouches]; + LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Cancellable Content Touches" flag:self.canCancelContentTouches]; model14.changePropertyBlock = ^(id _Nullable obj) { weakSelf.canCancelContentTouches = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -1493,14 +1509,14 @@ @implementation UITableViewCell (LL_Hierarchy) }; [settings addObject:model7]; - LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Indent While Editing %@",[self LL_hierarchyBoolDescription:self.shouldIndentWhileEditing]] flag:self.shouldIndentWhileEditing] noneInsets]; + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Indent While Editing" flag:self.shouldIndentWhileEditing] noneInsets]; model8.changePropertyBlock = ^(id _Nullable obj) { weakSelf.shouldIndentWhileEditing = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model8]; - LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Re-order Controls %@",[self LL_hierarchyBoolDescription:self.showsReorderControl]] flag:self.showsReorderControl]; + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Shows Re-order Controls" flag:self.showsReorderControl]; model9.changePropertyBlock = ^(id _Nullable obj) { weakSelf.showsReorderControl = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -1605,7 +1621,7 @@ @implementation UITextView (LL_Hierarchy) }; [settings addObject:model2]; - LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Allows Editing Attributes %@",[self LL_hierarchyBoolDescription:self.allowsEditingTextAttributes]] flag:self.allowsEditingTextAttributes] noneInsets]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Allows Editing Attributes" flag:self.allowsEditingTextAttributes] noneInsets]; model3.changePropertyBlock = ^(id _Nullable obj) { weakSelf.allowsEditingTextAttributes = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -1631,21 +1647,21 @@ @implementation UITextView (LL_Hierarchy) }; [settings addObject:model6]; - LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:[NSString stringWithFormat:@"Editable %@",[self LL_hierarchyBoolDescription:self.isEditable]] flag:self.isEditable] noneInsets]; + LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:@"Editable" flag:self.isEditable] noneInsets]; model7.changePropertyBlock = ^(id _Nullable obj) { weakSelf.editable = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model7]; - LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Selectable %@",[self LL_hierarchyBoolDescription:self.isSelectable]] flag:self.isSelectable]; + LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Selectable" flag:self.isSelectable]; model8.changePropertyBlock = ^(id _Nullable obj) { weakSelf.selectable = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model8]; - LLTitleCellModel *model9 = [[[LLTitleCellModel alloc] initWithTitle:@"Data Detectors" detailTitle:[NSString stringWithFormat:@"Phone Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypePhoneNumber]] flag:self.dataDetectorTypes & UIDataDetectorTypePhoneNumber] noneInsets]; + LLTitleCellModel *model9 = [[[LLTitleCellModel alloc] initWithTitle:@"Data Detectors" detailTitle:@"Phone Number" flag:self.dataDetectorTypes & UIDataDetectorTypePhoneNumber] noneInsets]; model9.changePropertyBlock = ^(id _Nullable obj) { if ([obj boolValue]) { weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes | UIDataDetectorTypePhoneNumber; @@ -1655,7 +1671,7 @@ @implementation UITextView (LL_Hierarchy) }; [settings addObject:model9]; - LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Link %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeLink]] flag:self.dataDetectorTypes & UIDataDetectorTypeLink] noneInsets]; + LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Link" flag:self.dataDetectorTypes & UIDataDetectorTypeLink] noneInsets]; model10.changePropertyBlock = ^(id _Nullable obj) { if ([obj boolValue]) { weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes | UIDataDetectorTypeLink; @@ -1665,7 +1681,7 @@ @implementation UITextView (LL_Hierarchy) }; [settings addObject:model10]; - LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Address %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeAddress]] flag:self.dataDetectorTypes & UIDataDetectorTypeAddress] noneInsets]; + LLTitleCellModel *model11 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Address" flag:self.dataDetectorTypes & UIDataDetectorTypeAddress] noneInsets]; model11.changePropertyBlock = ^(id _Nullable obj) { if ([obj boolValue]) { weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes | UIDataDetectorTypeAddress; @@ -1675,7 +1691,7 @@ @implementation UITextView (LL_Hierarchy) }; [settings addObject:model11]; - LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Calendar Event %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeCalendarEvent]] flag:self.dataDetectorTypes & UIDataDetectorTypeCalendarEvent] noneInsets]; + LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Calendar Event" flag:self.dataDetectorTypes & UIDataDetectorTypeCalendarEvent] noneInsets]; model12.changePropertyBlock = ^(id _Nullable obj) { if ([obj boolValue]) { weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes | UIDataDetectorTypeCalendarEvent; @@ -1686,7 +1702,7 @@ @implementation UITextView (LL_Hierarchy) [settings addObject:model12]; if (@available(iOS 10.0, *)) { - LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shipment Tracking Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeShipmentTrackingNumber]] flag:self.dataDetectorTypes & UIDataDetectorTypeShipmentTrackingNumber] noneInsets]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Shipment Tracking Number" flag:self.dataDetectorTypes & UIDataDetectorTypeShipmentTrackingNumber] noneInsets]; model13.changePropertyBlock = ^(id _Nullable obj) { if ([obj boolValue]) { weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes | UIDataDetectorTypeShipmentTrackingNumber; @@ -1696,7 +1712,7 @@ @implementation UITextView (LL_Hierarchy) }; [settings addObject:model13]; - LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Flight Number %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeFlightNumber]] flag:self.dataDetectorTypes & UIDataDetectorTypeFlightNumber] noneInsets]; + LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Flight Number" flag:self.dataDetectorTypes & UIDataDetectorTypeFlightNumber] noneInsets]; model14.changePropertyBlock = ^(id _Nullable obj) { if ([obj boolValue]) { weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes | UIDataDetectorTypeFlightNumber; @@ -1706,7 +1722,7 @@ @implementation UITextView (LL_Hierarchy) }; [settings addObject:model14]; - LLTitleCellModel *model15 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Lookup Suggestion %@",[self LL_hierarchyBoolDescription:self.dataDetectorTypes & UIDataDetectorTypeLookupSuggestion]] flag:self.dataDetectorTypes & UIDataDetectorTypeLookupSuggestion]; + LLTitleCellModel *model15 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Lookup Suggestion" flag:self.dataDetectorTypes & UIDataDetectorTypeLookupSuggestion]; model15.changePropertyBlock = ^(id _Nullable obj) { if ([obj boolValue]) { weakSelf.dataDetectorTypes = weakSelf.dataDetectorTypes | UIDataDetectorTypeLookupSuggestion; @@ -1759,14 +1775,14 @@ @implementation UITextView (LL_Hierarchy) }; [settings addObject:model20]; - LLTitleCellModel *model21 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Auto-enable Return Key %@",[self LL_hierarchyBoolDescription:self.enablesReturnKeyAutomatically]] flag:self.enablesReturnKeyAutomatically] noneInsets]; + LLTitleCellModel *model21 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Auto-enable Return Key" flag:self.enablesReturnKeyAutomatically] noneInsets]; model21.changePropertyBlock = ^(id _Nullable obj) { weakSelf.enablesReturnKeyAutomatically = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model21]; - LLTitleCellModel *model22 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Secure Entry %@",[self LL_hierarchyBoolDescription:self.isSecureTextEntry]] flag:self.isSecureTextEntry]; + LLTitleCellModel *model22 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Secure Entry" flag:self.isSecureTextEntry]; model22.changePropertyBlock = ^(id _Nullable obj) { weakSelf.secureTextEntry = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -1896,7 +1912,7 @@ @implementation UINavigationBar (LL_Hierarchy) }; [settings addObject:model1]; - LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]] flag:self.isTranslucent] noneInsets]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Translucent" flag:self.isTranslucent] noneInsets]; model2.changePropertyBlock = ^(id _Nullable obj) { weakSelf.translucent = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -1904,7 +1920,7 @@ @implementation UINavigationBar (LL_Hierarchy) [settings addObject:model2]; if (@available(iOS 11.0, *)) { - LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Prefers Large Titles %@",[self LL_hierarchyBoolDescription:self.prefersLargeTitles]] flag:self.prefersLargeTitles] noneInsets]; + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Prefers Large Titles" flag:self.prefersLargeTitles] noneInsets]; model3.changePropertyBlock = ^(id _Nullable obj) { weakSelf.prefersLargeTitles = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -2020,7 +2036,7 @@ @implementation UIToolbar (LL_Hierarchy) }; [settings addObject:model1]; - LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]] flag:self.isTranslucent] noneInsets]; + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Translucent" flag:self.isTranslucent] noneInsets]; model2.changePropertyBlock = ^(id _Nullable obj) { weakSelf.translucent = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -2066,7 +2082,7 @@ @implementation UITabBar (LL_Hierarchy) }; [settings addObject:model4]; - LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]] flag:self.isTranslucent] noneInsets]; + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Translucent" flag:self.isTranslucent] noneInsets]; model5.changePropertyBlock = ^(id _Nullable obj) { weakSelf.translucent = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -2159,7 +2175,7 @@ @implementation UISearchBar (LL_Hierarchy) }; [settings addObject:model5]; - LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Translucent %@",[self LL_hierarchyBoolDescription:self.isTranslucent]] flag:self.isTranslucent] noneInsets]; + LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Translucent" flag:self.isTranslucent] noneInsets]; model6.changePropertyBlock = ^(id _Nullable obj) { weakSelf.translucent = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; @@ -2181,28 +2197,28 @@ @implementation UISearchBar (LL_Hierarchy) LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:@"BG Offset" detailTitle:[self LL_hierarchyOffsetDescription:self.searchFieldBackgroundPositionAdjustment]]; [settings addObject:model11]; - LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Options" detailTitle:[NSString stringWithFormat:@"Shows Search Results Button %@",[self LL_hierarchyBoolDescription:self.showsSearchResultsButton]] flag:self.showsSearchResultsButton] noneInsets]; + LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Options" detailTitle:@"Shows Search Results Button" flag:self.showsSearchResultsButton] noneInsets]; model12.changePropertyBlock = ^(id _Nullable obj) { weakSelf.showsSearchResultsButton = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model12]; - LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Bookmarks Button %@",[self LL_hierarchyBoolDescription:self.showsBookmarkButton]] flag:self.showsBookmarkButton] noneInsets]; + LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Shows Bookmarks Button" flag:self.showsBookmarkButton] noneInsets]; model13.changePropertyBlock = ^(id _Nullable obj) { weakSelf.showsBookmarkButton = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model13]; - LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Cancel Button %@",[self LL_hierarchyBoolDescription:self.showsCancelButton]] flag:self.showsCancelButton] noneInsets]; + LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Shows Cancel Button" flag:self.showsCancelButton] noneInsets]; model14.changePropertyBlock = ^(id _Nullable obj) { weakSelf.showsCancelButton = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; }; [settings addObject:model14]; - LLTitleCellModel *model15 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[NSString stringWithFormat:@"Shows Scope Bar %@",[self LL_hierarchyBoolDescription:self.showsScopeBar]] flag:self.showsScopeBar]; + LLTitleCellModel *model15 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:@"Shows Scope Bar" flag:self.showsScopeBar]; model15.changePropertyBlock = ^(id _Nullable obj) { weakSelf.showsScopeBar = [obj boolValue]; [weakSelf LL_postHierarchyChangeNotification]; diff --git a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleSwitchCell.m b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleSwitchCell.m index 309082d8..92c14364 100644 --- a/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleSwitchCell.m +++ b/LLDebugTool/Core/Others/CommonUI/View/TitleCell/LLTitleSwitchCell.m @@ -45,8 +45,8 @@ - (void)initUI { [self.swit mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self.detailLabel.mas_right).offset(kLLGeneralMargin / 2.0); make.right.mas_equalTo(-kLLGeneralMargin); - make.top.mas_equalTo(kLLGeneralMargin); - make.bottom.mas_equalTo(-kLLGeneralMargin); + make.centerY.equalTo(self.contentView); + make.size.mas_equalTo(CGSizeMake(51, 31)); }]; } From a7678117d8550fe7ec6699fc3ac67c0fc04e3677 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Tue, 29 Oct 2019 15:10:27 +0800 Subject: [PATCH 35/45] Add frame and layout in hierarchy. --- .../Function/NSObject+LL_Hierarchy.h | 6 + .../Function/NSObject+LL_Hierarchy.m | 147 +++++++++++++++++- .../LLHierarchyDetailViewController.m | 17 +- .../EnumDescription/LLEnumDescription.h | 6 + .../EnumDescription/LLEnumDescription.m | 73 +++++++++ 5 files changed, 247 insertions(+), 2 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.h b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.h index 63d26c77..0a101446 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.h +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.h @@ -35,4 +35,10 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface UIView (LL_Hierarchy) + +- (NSArray *)LL_sizeHierarchyCategoryModels; + +@end + NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 83fb8750..2fa491d6 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -99,8 +99,22 @@ - (NSString *)LL_hierarchyTextDescription:(NSString *)text { return text; } +- (NSString *)LL_hierarchyPointDescription:(CGPoint)point { + return [NSString stringWithFormat:@"X: %@ Y: %@",[LLFormatterTool formatNumber:@(point.x)],[LLFormatterTool formatNumber:@(point.y)]]; +} + +- (CGPoint)LL_pointFromString:(NSString *)string orginalPoint:(CGPoint)point { + CGPoint newPoint = CGPointFromString(string); + return newPoint; +} + - (NSString *)LL_hierarchySizeDescription:(CGSize)size { - return [NSString stringWithFormat:@"w %@ h %@",[LLFormatterTool formatNumber:@(size.width)], [LLFormatterTool formatNumber:@(size.height)]]; + return [NSString stringWithFormat:@"W: %@ H: %@",[LLFormatterTool formatNumber:@(size.width)], [LLFormatterTool formatNumber:@(size.height)]]; +} + +- (CGRect)LL_rectFromString:(NSString *)string originalRect:(CGRect)rect { + CGRect newRect = CGRectFromString(string); + return newRect; } - (CGSize)LL_sizeFromString:(NSString *)string originalSize:(CGSize)size { @@ -293,6 +307,137 @@ @implementation UIView (LL_Hierarchy) return [models copy]; } +- (NSArray *)LL_sizeHierarchyCategoryModels { + __weak typeof(self) weakSelf = self; + NSMutableArray *settings = [[NSMutableArray alloc] init]; + + LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Frame" detailTitle:[self LL_hierarchyPointDescription:self.frame.origin]] noneInsets]; + model1.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromCGRect(weakSelf.frame) handler:^(NSString * _Nullable newText) { + weakSelf.frame = [weakSelf LL_rectFromString:newText originalRect:weakSelf.frame]; + }]; + }; + [settings addObject:model1]; + + LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchySizeDescription:self.frame.size]] noneInsets]; + [settings addObject:model2]; + + LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Bounds" detailTitle:[self LL_hierarchyPointDescription:self.bounds.origin]] noneInsets]; + model3.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromCGRect(weakSelf.bounds) handler:^(NSString * _Nullable newText) { + weakSelf.bounds = [weakSelf LL_rectFromString:newText originalRect:weakSelf.bounds]; + }]; + }; + [settings addObject:model3]; + + LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchySizeDescription:self.bounds.size]] noneInsets]; + [settings addObject:model4]; + + LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Center" detailTitle:[self LL_hierarchyPointDescription:self.center]] noneInsets]; + model5.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromCGPoint(weakSelf.center) handler:^(NSString * _Nullable newText) { + weakSelf.center = [weakSelf LL_pointFromString:newText orginalPoint:weakSelf.center]; + }]; + }; + [settings addObject:model5]; + + LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Position" detailTitle:[self LL_hierarchyPointDescription:self.layer.position]] noneInsets]; + model6.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromCGPoint(weakSelf.layer.position) handler:^(NSString * _Nullable newText) { + weakSelf.layer.position = [weakSelf LL_pointFromString:newText orginalPoint:weakSelf.layer.position]; + }]; + }; + [settings addObject:model6]; + + LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:@"Z Position" detailTitle:[LLFormatterTool formatNumber:@(self.layer.zPosition)]]; + model7.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.layer.zPosition)] handler:^(NSString * _Nullable newText) { + weakSelf.layer.zPosition = [newText doubleValue]; + }]; + }; + [settings addObject:model7]; + + LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Anchor Point" detailTitle:[self LL_hierarchyPointDescription:self.layer.anchorPoint]] noneInsets]; + model8.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromCGPoint(weakSelf.layer.anchorPoint) handler:^(NSString * _Nullable newText) { + weakSelf.layer.anchorPoint = [weakSelf LL_pointFromString:newText orginalPoint:weakSelf.layer.anchorPoint]; + }]; + }; + [settings addObject:model8]; + + LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Anchor Point Z" detailTitle:[LLFormatterTool formatNumber:@(self.layer.anchorPointZ)]]; + model9.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.layer.anchorPointZ)] handler:^(NSString * _Nullable newText) { + weakSelf.layer.anchorPointZ = [newText doubleValue]; + }]; + }; + [settings addObject:model9]; + + for (NSLayoutConstraint *constrain in self.constraints) { + if (!constrain.shouldBeArchived) { + continue; + } + NSString *constrainDesc = [self LL_hierarchyLayoutConstraintDescription:constrain]; + if (constrainDesc) { + LLTitleCellModel *mod = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:constrainDesc]; + [settings addObject:mod]; + } + } + + for (NSLayoutConstraint *constrain in self.superview.constraints) { + if (!constrain.shouldBeArchived) { + continue; + } + if (constrain.firstItem == self || constrain.secondItem == self) { + NSString *constrainDesc = [self LL_hierarchyLayoutConstraintDescription:constrain]; + if (constrainDesc) { + LLTitleCellModel *mod = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:constrainDesc]; + [settings addObject:mod]; + } + } + } + + return @[[[LLTitleCellCategoryModel alloc] initWithTitle:@"View" items:settings]]; +} + +- (NSString *)LL_hierarchyLayoutConstraintDescription:(NSLayoutConstraint *)constraint { + NSMutableString *string = [[NSMutableString alloc] init]; + if (constraint.firstItem == self) { + [string appendString:@"self."]; + } else if (constraint.firstItem == self.superview) { + [string appendString:@"superview."]; + } else { + [string appendFormat:@"%@.",NSStringFromClass([constraint.firstItem class])]; + } + [string appendString:[LLEnumDescription layoutAttributeDescription:constraint.firstAttribute]]; + [string appendString:[LLEnumDescription layoutRelationDescription:constraint.relation]]; + if (constraint.secondItem) { + if (constraint.secondItem == self) { + [string appendString:@"self."]; + } else if (constraint.secondItem == self.superview) { + [string appendString:@"superview."]; + } else { + [string appendFormat:@"%@.",NSStringFromClass([constraint.secondItem class])]; + } + [string appendString:[LLEnumDescription layoutAttributeDescription:constraint.secondAttribute]]; + if (constraint.multiplier != 1) { + [string appendFormat:@" * %@",[LLFormatterTool formatNumber:@(constraint.multiplier)]]; + } + if (constraint.constant > 0) { + [string appendFormat:@" + %@",[LLFormatterTool formatNumber:@(constraint.constant)]]; + } else if (constraint.constant < 0) { + [string appendFormat:@" - %@",[LLFormatterTool formatNumber:@(fabs(constraint.constant))]]; + } + } else if (constraint.constant) { + [string appendString:[LLFormatterTool formatNumber:@(constraint.constant)]]; + } else { + return nil; + } + + [string appendFormat:@" @ %@",[LLFormatterTool formatNumber:@(constraint.priority)]]; + return string; +} + @end @implementation UILabel (LL_Hierarchy) diff --git a/LLDebugTool/Core/Component/Hierarchy/UserInterface/LLHierarchyDetailViewController.m b/LLDebugTool/Core/Component/Hierarchy/UserInterface/LLHierarchyDetailViewController.m index c826e8ae..491bb5b6 100644 --- a/LLDebugTool/Core/Component/Hierarchy/UserInterface/LLHierarchyDetailViewController.m +++ b/LLDebugTool/Core/Component/Hierarchy/UserInterface/LLHierarchyDetailViewController.m @@ -92,11 +92,25 @@ - (void)didReceiveLLHierarchyChangeNotification:(NSNotification *)notification { [self loadData]; } +#pragma mark - Event responses +- (void)segmentedControlValueChanged:(UISegmentedControl *)sender { + [self reloadTableView]; +} + #pragma mark - Primary - (void)loadData { [self.objectDatas removeAllObjects]; NSArray *models = [self.selectView LL_hierarchyCategoryModels]; [self.objectDatas addObjectsFromArray:models]; + + [self.sizeDatas removeAllObjects]; + NSArray *sizeModels = [self.selectView LL_sizeHierarchyCategoryModels]; + [self.sizeDatas addObjectsFromArray:sizeModels]; + + [self reloadTableView]; +} + +- (void)reloadTableView { [self.dataArray removeAllObjects]; if (self.segmentedControl.selectedSegmentIndex == 0) { [self.dataArray addObjectsFromArray:self.objectDatas]; @@ -109,9 +123,10 @@ - (void)loadData { #pragma mark - Getters and setters - (UISegmentedControl *)segmentedControl { if (!_segmentedControl) { - _segmentedControl = [LLFactory getSegmentedControl:nil frame:CGRectMake(kLLGeneralMargin, kLLGeneralMargin, self.view.LL_width - kLLGeneralMargin * 2, 30) items:@[@"Object"]/*@[@"Object", @"Size"]*/]; + _segmentedControl = [LLFactory getSegmentedControl:nil frame:CGRectMake(kLLGeneralMargin, kLLGeneralMargin, self.view.LL_width - kLLGeneralMargin * 2, 30) items:@[@"Object", @"Size"]]; [_segmentedControl setTitleTextAttributes:@{NSForegroundColorAttributeName : [LLThemeManager shared].primaryColor} forState:UIControlStateNormal]; [_segmentedControl setTitleTextAttributes:@{NSForegroundColorAttributeName : [LLThemeManager shared].backgroundColor} forState:UIControlStateSelected]; + [_segmentedControl addTarget:self action:@selector(segmentedControlValueChanged:) forControlEvents:UIControlEventValueChanged]; _segmentedControl.backgroundColor = [LLThemeManager shared].containerColor; _segmentedControl.tintColor = [LLThemeManager shared].primaryColor; #ifdef __IPHONE_13_0 diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h index 85d4d6e4..07ae7538 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.h @@ -140,6 +140,12 @@ NS_ASSUME_NONNULL_BEGIN + (NSArray *)tabBarItemPositionings; ++ (NSString *_Nullable)layoutAttributeDescription:(NSLayoutAttribute)attribute; + ++ (NSArray *)layoutAttributes; + ++ (NSString *_Nullable)layoutRelationDescription:(NSLayoutRelation)relation; + @end NS_ASSUME_NONNULL_END diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m index 71f9ac79..5b6f018f 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m @@ -813,4 +813,77 @@ + (NSString *)tabBarItemPositioningDescription:(UITabBarItemPositioning)position return [positionings copy]; } ++ (NSString *_Nullable)layoutAttributeDescription:(NSLayoutAttribute)attribute { + switch (attribute) { + case NSLayoutAttributeLeft: + return @"Left"; + case NSLayoutAttributeRight: + return @"Right"; + case NSLayoutAttributeTop: + return @"Top"; + case NSLayoutAttributeBottom: + return @"Bottom"; + case NSLayoutAttributeLeading: + return @"Leading"; + case NSLayoutAttributeTrailing: + return @"Trailing"; + case NSLayoutAttributeWidth: + return @"Width"; + case NSLayoutAttributeHeight: + return @"Height"; + case NSLayoutAttributeCenterX: + return @"CenterX"; + case NSLayoutAttributeCenterY: + return @"CenterY"; + case NSLayoutAttributeLastBaseline: + return @"LastBaseline"; + case NSLayoutAttributeFirstBaseline: + return @"FirstBaseline"; + case NSLayoutAttributeLeftMargin: + return @"LeftMargin"; + case NSLayoutAttributeRightMargin: + return @"RightMargin"; + case NSLayoutAttributeTopMargin: + return @"TopMargin"; + case NSLayoutAttributeBottomMargin: + return @"BottomMargin"; + case NSLayoutAttributeLeadingMargin: + return @"LeadingMargin"; + case NSLayoutAttributeTrailingMargin: + return @"TrailingMargin"; + case NSLayoutAttributeCenterXWithinMargins: + return @"CenterXMargin"; + case NSLayoutAttributeCenterYWithinMargins: + return @"CenterYMargin"; + case NSLayoutAttributeNotAnAttribute: + return nil; + default: + return nil; + } +} + ++ (NSArray *)layoutAttributes { + NSMutableArray *attributes = [[NSMutableArray alloc] init]; + for (NSLayoutAttribute i = NSLayoutAttributeNotAnAttribute; i <= NSLayoutAttributeCenterYWithinMargins; i++) { + NSString *attribute = [self layoutAttributeDescription:i]; + if (attribute) { + [attributes addObject:attribute]; + } + } + return [attributes copy]; +} + ++ (NSString *_Nullable)layoutRelationDescription:(NSLayoutRelation)relation { + switch (relation) { + case NSLayoutRelationLessThanOrEqual: + return @"<="; + case NSLayoutRelationEqual: + return @"="; + case NSLayoutRelationGreaterThanOrEqual: + return @">="; + default: + return nil; + } +} + @end From 0391f4fc149626832cf496f5d91c270b51d46bd2 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Thu, 31 Oct 2019 09:58:04 +0800 Subject: [PATCH 36/45] Add constraint control. --- .../Function/NSObject+LL_Hierarchy.m | 22 +++++++++- .../EnumDescription/LLEnumDescription.m | 40 +++++++++---------- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 2fa491d6..3a54beca 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -373,14 +373,23 @@ @implementation UIView (LL_Hierarchy) }; [settings addObject:model9]; + LLTitleCellModel *lastConstrainModel = nil; + for (NSLayoutConstraint *constrain in self.constraints) { if (!constrain.shouldBeArchived) { continue; } NSString *constrainDesc = [self LL_hierarchyLayoutConstraintDescription:constrain]; if (constrainDesc) { - LLTitleCellModel *mod = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:constrainDesc]; + LLTitleCellModel *mod = [[[LLTitleCellModel alloc] initWithTitle:lastConstrainModel ? nil : @"Constrains" detailTitle:constrainDesc] noneInsets]; + __weak NSLayoutConstraint *cons = constrain; + mod.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(cons.constant)] handler:^(NSString * _Nullable newText) { + cons.constant = [newText doubleValue]; + }]; + }; [settings addObject:mod]; + lastConstrainModel = mod; } } @@ -391,12 +400,21 @@ @implementation UIView (LL_Hierarchy) if (constrain.firstItem == self || constrain.secondItem == self) { NSString *constrainDesc = [self LL_hierarchyLayoutConstraintDescription:constrain]; if (constrainDesc) { - LLTitleCellModel *mod = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:constrainDesc]; + LLTitleCellModel *mod = [[[LLTitleCellModel alloc] initWithTitle:lastConstrainModel ? nil : @"Constrains" detailTitle:constrainDesc] noneInsets]; + __weak NSLayoutConstraint *cons = constrain; + mod.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(cons.constant)] handler:^(NSString * _Nullable newText) { + cons.constant = [newText doubleValue]; + }]; + }; [settings addObject:mod]; + lastConstrainModel = mod; } } } + [lastConstrainModel normalInsets]; + return @[[[LLTitleCellCategoryModel alloc] initWithTitle:@"View" items:settings]]; } diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m index 5b6f018f..d5f72416 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m @@ -816,45 +816,45 @@ + (NSString *)tabBarItemPositioningDescription:(UITabBarItemPositioning)position + (NSString *_Nullable)layoutAttributeDescription:(NSLayoutAttribute)attribute { switch (attribute) { case NSLayoutAttributeLeft: - return @"Left"; + return @"left"; case NSLayoutAttributeRight: - return @"Right"; + return @"right"; case NSLayoutAttributeTop: - return @"Top"; + return @"top"; case NSLayoutAttributeBottom: - return @"Bottom"; + return @"bottom"; case NSLayoutAttributeLeading: - return @"Leading"; + return @"leading"; case NSLayoutAttributeTrailing: - return @"Trailing"; + return @"trailing"; case NSLayoutAttributeWidth: - return @"Width"; + return @"width"; case NSLayoutAttributeHeight: - return @"Height"; + return @"height"; case NSLayoutAttributeCenterX: - return @"CenterX"; + return @"centerX"; case NSLayoutAttributeCenterY: - return @"CenterY"; + return @"centerY"; case NSLayoutAttributeLastBaseline: - return @"LastBaseline"; + return @"lastBaseline"; case NSLayoutAttributeFirstBaseline: - return @"FirstBaseline"; + return @"firstBaseline"; case NSLayoutAttributeLeftMargin: - return @"LeftMargin"; + return @"leftMargin"; case NSLayoutAttributeRightMargin: - return @"RightMargin"; + return @"rightMargin"; case NSLayoutAttributeTopMargin: - return @"TopMargin"; + return @"topMargin"; case NSLayoutAttributeBottomMargin: - return @"BottomMargin"; + return @"bottomMargin"; case NSLayoutAttributeLeadingMargin: - return @"LeadingMargin"; + return @"leadingMargin"; case NSLayoutAttributeTrailingMargin: - return @"TrailingMargin"; + return @"trailingMargin"; case NSLayoutAttributeCenterXWithinMargins: - return @"CenterXMargin"; + return @"centerXMargin"; case NSLayoutAttributeCenterYWithinMargins: - return @"CenterYMargin"; + return @"centerYMargin"; case NSLayoutAttributeNotAnAttribute: return nil; default: From 86fcb21acf3de3d618af5ef43cf1e44e5cf95258 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Thu, 31 Oct 2019 10:49:48 +0800 Subject: [PATCH 37/45] Dynamic color properties. --- .../Function/NSObject+LL_Hierarchy.m | 111 +++++++++++++++++- .../Category/UIColor/UIColor+LL_Utils.h | 2 + .../Category/UIColor/UIColor+LL_Utils.m | 13 ++ 3 files changed, 125 insertions(+), 1 deletion(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 3a54beca..ef8460dd 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -29,6 +29,7 @@ #import "LLEnumDescription.h" #import "LLTool.h" #import "UIViewController+LL_Utils.h" +#import "UIColor+LL_Utils.h" NSNotificationName const LLHierarchyChangeNotificationName = @"LLHierarchyChangeNotificationName"; @@ -60,7 +61,27 @@ - (NSString *)LL_hierarchyColorDescription:(UIColor *_Nullable)color { NSString *colorName = [color LL_systemColorName]; - return colorName ? [rgb stringByAppendingFormat:@"\n%@",colorName] : rgb; + return colorName ? [rgb stringByAppendingFormat:@"\n%@",colorName] : [rgb stringByAppendingFormat:@"\n%@",[color LL_HexString]]; +} + +- (UIColor *)LL_colorFromString:(NSString *)string originalColor:(UIColor *)color { + BOOL error = NO; + UIColor *newColor = [UIColor LL_colorWithHex:string error:&error]; + if (error) { + return color; + } + return newColor; +} + +- (void)LL_showColorAlertAndAutomicSetWithKey:(NSString *)key { + __block UIColor *color = [self valueForKey:key]; + if (color && ![color isKindOfClass:[UIColor class]]) { + return; + } + __weak typeof(self) weakSelf = self; + [self LL_showHierarchyChangeAlertWithText:[color LL_HexString] handler:^(NSString * _Nullable newText) { + [weakSelf setValue:[weakSelf LL_colorFromString:newText originalColor:color] forKey:key]; + }]; } - (NSString *)LL_hierarchyBoolDescription:(BOOL)flag { @@ -237,9 +258,15 @@ @implementation UIView (LL_Hierarchy) [settings addObject:model7]; LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Background" detailTitle:[self LL_hierarchyColorDescription:self.backgroundColor]] noneInsets]; + model8.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"backgroundColor"]; + }; [settings addObject:model8]; LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Tint" detailTitle:[self LL_hierarchyColorDescription:self.tintColor]]; + model9.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"tintColor"]; + }; [settings addObject:model9]; LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Drawing" detailTitle:@"Opaque" flag:self.isOpaque] noneInsets]; @@ -480,6 +507,9 @@ @implementation UILabel (LL_Hierarchy) [settings addObject:model2]; LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Text" detailTitle:[self LL_hierarchyColorDescription:self.textColor]] noneInsets]; + model3.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"textColor"]; + }; [settings addObject:model3]; LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyObjectDescription:self.font]] noneInsets]; @@ -545,9 +575,15 @@ @implementation UILabel (LL_Hierarchy) [settings addObject:model11]; LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Highlighted" detailTitle:[self LL_hierarchyColorDescription:self.highlightedTextColor]] noneInsets]; + model12.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"highlightedTextColor"]; + }; [settings addObject:model12]; LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:@"Shadow" detailTitle:[self LL_hierarchyColorDescription:self.shadowColor]] noneInsets]; + model13.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"shadowColor"]; + }; [settings addObject:model13]; LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:self.shadowOffset]]; @@ -654,9 +690,19 @@ @implementation UIButton (LL_Hierarchy) [settings addObject:model4]; LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Text Color" detailTitle:[self LL_hierarchyColorDescription:self.currentTitleColor]] noneInsets]; + model5.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[weakSelf.currentTitleColor LL_HexString] handler:^(NSString * _Nullable newText) { + [weakSelf setTitleColor:[weakSelf LL_colorFromString:newText originalColor:weakSelf.currentTitleColor] forState:weakSelf.state]; + }]; + }; [settings addObject:model5]; LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Shadow Color" detailTitle:[self LL_hierarchyColorDescription:self.currentTitleShadowColor]]; + model6.block = ^{ + [weakSelf LL_showHierarchyChangeAlertWithText:[weakSelf.currentTitleShadowColor LL_HexString] handler:^(NSString * _Nullable newText) { + [weakSelf setTitleShadowColor:[weakSelf LL_colorFromString:newText originalColor:weakSelf.currentTitleShadowColor] forState:weakSelf.state]; + }]; + }; [settings addObject:model6]; id target = self.allTargets.allObjects.firstObject; @@ -808,6 +854,9 @@ @implementation UITextField (LL_Hierarchy) [settings addObject:model3]; LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.textColor]] noneInsets]; + model4.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"textColor"]; + }; [settings addObject:model4]; LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Font" detailTitle:[self LL_hierarchyObjectDescription:self.font]] noneInsets]; @@ -1059,12 +1108,21 @@ @implementation UISlider (LL_Hierarchy) [settings addObject:model5]; LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Track Tint" detailTitle:[self LL_hierarchyColorDescription:self.minimumTrackTintColor]] noneInsets]; + model6.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"minimumTrackTintColor"]; + }; [settings addObject:model6]; LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Max Track Tint" detailTitle:[self LL_hierarchyColorDescription:self.maximumTrackTintColor]] noneInsets]; + model7.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"maximumTrackTintColor"]; + }; [settings addObject:model7]; LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:@"Thumb Tint" detailTitle:[self LL_hierarchyColorDescription:self.tintColor]]; + model8.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"tintColor"]; + }; [settings addObject:model8]; LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Events" detailTitle:@"Continuous Update" flag:self.isContinuous]; @@ -1101,9 +1159,15 @@ @implementation UISwitch (LL_Hierarchy) [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"On Tint" detailTitle:[self LL_hierarchyColorDescription:self.onTintColor]] noneInsets]; + model2.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"onTintColor"]; + }; [settings addObject:model2]; LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Thumb Tint" detailTitle:[self LL_hierarchyColorDescription:self.thumbTintColor]]; + model3.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"thumbTintColor"]; + }; [settings addObject:model3]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Switch" items:settings]; @@ -1140,6 +1204,9 @@ @implementation UIActivityIndicatorView (LL_Hierarchy) [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.color]] noneInsets]; + model2.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"color"]; + }; [settings addObject:model2]; LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Behavior" detailTitle:@"Animating" flag:self.isAnimating] noneInsets]; @@ -1200,9 +1267,15 @@ @implementation UIProgressView (LL_Hierarchy) [settings addObject:model2]; LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Progress Tint" detailTitle:[self LL_hierarchyColorDescription:self.progressTintColor]] noneInsets]; + model3.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"progressTintColor"]; + }; [settings addObject:model3]; LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:@"Track Tint" detailTitle:[self LL_hierarchyColorDescription:self.trackTintColor]]; + model4.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"trackTintColor"]; + }; [settings addObject:model4]; LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Progress Image" detailTitle:[self LL_hierarchyImageDescription:self.progressImage]] noneInsets]; @@ -1271,9 +1344,15 @@ @implementation UIPageControl (LL_Hierarchy) [settings addObject:model4]; LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Tint Color" detailTitle:[self LL_hierarchyColorDescription:self.pageIndicatorTintColor]] noneInsets]; + model5.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"pageIndicatorTintColor"]; + }; [settings addObject:model5]; LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Current Page" detailTitle:[self LL_hierarchyColorDescription:self.currentPageIndicatorTintColor]]; + model6.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"currentPageIndicatorTintColor"]; + }; [settings addObject:model6]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Page Control" items:settings]; @@ -1509,6 +1588,9 @@ @implementation UITableView (LL_Hierarchy) [settings addObject:model3]; LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyColorDescription:self.separatorColor]]; + model4.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"separatorColor"]; + }; [settings addObject:model4]; LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Data Source" detailTitle:[self LL_hierarchyObjectDescription:self.dataSource]] noneInsets]; @@ -1575,12 +1657,24 @@ @implementation UITableView (LL_Hierarchy) [settings addObject:model14]; LLTitleCellModel *model15 = [[[LLTitleCellModel alloc] initWithTitle:@"Text" detailTitle:[self LL_hierarchyColorDescription:self.sectionIndexColor]] noneInsets]; + model15.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"sectionIndexColor"]; + }; [settings addObject:model15]; LLTitleCellModel *model16 = [[[LLTitleCellModel alloc] initWithTitle:@"Background" detailTitle:[self LL_hierarchyColorDescription:self.sectionIndexBackgroundColor]] noneInsets]; + model16.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"sectionIndexBackgroundColor"]; + }; [settings addObject:model16]; LLTitleCellModel *model17 = [[LLTitleCellModel alloc] initWithTitle:@"Tracking" detailTitle:[self LL_hierarchyColorDescription:self.sectionIndexTrackingBackgroundColor]]; + model17.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"sectionIndexTrackingBackgroundColor"]; + }; + model17.block = ^{ + + }; [settings addObject:model17]; LLTitleCellModel *model18 = [[[LLTitleCellModel alloc] initWithTitle:@"Row Height" detailTitle:[LLFormatterTool formatNumber:@(self.rowHeight)]] noneInsets]; @@ -1792,6 +1886,9 @@ @implementation UITextView (LL_Hierarchy) [settings addObject:model3]; LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.textColor]] noneInsets]; + model4.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"textColor"]; + }; [settings addObject:model4]; LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Font" detailTitle:[self LL_hierarchyObjectDescription:self.font]] noneInsets]; @@ -2092,6 +2189,9 @@ @implementation UINavigationBar (LL_Hierarchy) } LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Bar Tint" detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]] noneInsets]; + model4.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"barTintColor"]; + }; [settings addObject:model4]; LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Shadow Image" detailTitle:[self LL_hierarchyImageDescription:self.shadowImage]] noneInsets]; @@ -2207,6 +2307,9 @@ @implementation UIToolbar (LL_Hierarchy) [settings addObject:model2]; LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Bar Tint" detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; + model3.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"barTintColor"]; + }; [settings addObject:model3]; LLTitleCellCategoryModel *model = [[LLTitleCellCategoryModel alloc] initWithTitle:@"Tool Bar" items:settings]; @@ -2253,6 +2356,9 @@ @implementation UITabBar (LL_Hierarchy) [settings addObject:model5]; LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Bar Tint" detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; + model6.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"barTintColor"]; + }; [settings addObject:model6]; LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription tabBarItemPositioningDescription:self.itemPositioning]] noneInsets]; @@ -2346,6 +2452,9 @@ @implementation UISearchBar (LL_Hierarchy) [settings addObject:model6]; LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; + model7.block = ^{ + [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"barTintColor"]; + }; [settings addObject:model7]; LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Background" detailTitle:[self LL_hierarchyImageDescription:self.backgroundImage]] noneInsets]; diff --git a/LLDebugTool/Core/Others/Category/UIColor/UIColor+LL_Utils.h b/LLDebugTool/Core/Others/Category/UIColor/UIColor+LL_Utils.h index 0fab6aad..165dfb85 100644 --- a/LLDebugTool/Core/Others/Category/UIColor/UIColor+LL_Utils.h +++ b/LLDebugTool/Core/Others/Category/UIColor/UIColor+LL_Utils.h @@ -29,6 +29,8 @@ NS_ASSUME_NONNULL_BEGIN + (UIColor *)LL_colorWithHex:(NSString *)hex; ++ (UIColor *)LL_colorWithHex:(NSString *)hex error:(BOOL *_Nullable)error; + - (NSArray *)LL_RGBA; - (NSString *)LL_HexString; diff --git a/LLDebugTool/Core/Others/Category/UIColor/UIColor+LL_Utils.m b/LLDebugTool/Core/Others/Category/UIColor/UIColor+LL_Utils.m index 390c602e..9efaca4b 100644 --- a/LLDebugTool/Core/Others/Category/UIColor/UIColor+LL_Utils.m +++ b/LLDebugTool/Core/Others/Category/UIColor/UIColor+LL_Utils.m @@ -26,7 +26,14 @@ @implementation UIColor (LL_Utils) + (UIColor *)LL_colorWithHex:(NSString *)hex { + return [self LL_colorWithHex:hex error:nil]; +} + ++ (UIColor *)LL_colorWithHex:(NSString *)hex error:(BOOL *)error { if ([hex length] < 6){//长度不合法 + if (error) { + *error = YES; + } return [UIColor blackColor]; } NSString *tempString = [hex lowercaseString]; @@ -36,6 +43,9 @@ + (UIColor *)LL_colorWithHex:(NSString *)hex { tempString = [tempString substringFromIndex:1]; } if ([tempString length] != 6){ + if (error) { + *error = YES; + } return [UIColor blackColor]; } @@ -54,6 +64,9 @@ + (UIColor *)LL_colorWithHex:(NSString *)hex { [[NSScanner scannerWithString:rString] scanHexInt:&r]; [[NSScanner scannerWithString:gString] scanHexInt:&g]; [[NSScanner scannerWithString:bString] scanHexInt:&b]; + if (error) { + *error = NO; + } return [UIColor colorWithRed:((float) r / 255.0f) green:((float) g / 255.0f) blue:((float) b / 255.0f) From 694283bd1d640c626d02b3208eca5e17cd787e3c Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Thu, 31 Oct 2019 10:52:51 +0800 Subject: [PATCH 38/45] Rename. --- .../Function/NSObject+LL_Hierarchy.m | 130 +++++++++--------- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index ef8460dd..4c95fe07 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -79,7 +79,7 @@ - (void)LL_showColorAlertAndAutomicSetWithKey:(NSString *)key { return; } __weak typeof(self) weakSelf = self; - [self LL_showHierarchyChangeAlertWithText:[color LL_HexString] handler:^(NSString * _Nullable newText) { + [self LL_showTextFieldAlertWithText:[color LL_HexString] handler:^(NSString * _Nullable newText) { [weakSelf setValue:[weakSelf LL_colorFromString:newText originalColor:color] forKey:key]; }]; } @@ -170,7 +170,7 @@ - (NSString *)LL_hierarchyOffsetDescription:(UIOffset)offset { return [NSString stringWithFormat:@"h %@ v %@",[LLFormatterTool formatNumber:@(offset.horizontal)], [LLFormatterTool formatNumber:@(offset.vertical)]]; } -- (void)LL_showHierarchyChangeAlertWithText:(NSString *)text handler:(nullable void (^)(NSString * _Nullable newText))handler { +- (void)LL_showTextFieldAlertWithText:(NSString *)text handler:(nullable void (^)(NSString * _Nullable newText))handler { [[LLTool keyWindow].rootViewController.LL_currentShowingViewController LL_showTextFieldAlertControllerWithMessage:@"Change Property" text:text handler:^(NSString * _Nullable newText) { if (handler) { handler(newText); @@ -229,7 +229,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:@"Tag" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.tag]]; model4.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.tag] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.tag] handler:^(NSString * _Nullable newText) { weakSelf.tag = [newText integerValue]; }]; }; @@ -251,7 +251,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Alpha" detailTitle:[LLFormatterTool formatNumber:@(self.alpha)]] noneInsets]; model7.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(self.alpha)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(self.alpha)] handler:^(NSString * _Nullable newText) { weakSelf.alpha = [newText doubleValue]; }]; }; @@ -340,7 +340,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Frame" detailTitle:[self LL_hierarchyPointDescription:self.frame.origin]] noneInsets]; model1.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromCGRect(weakSelf.frame) handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:NSStringFromCGRect(weakSelf.frame) handler:^(NSString * _Nullable newText) { weakSelf.frame = [weakSelf LL_rectFromString:newText originalRect:weakSelf.frame]; }]; }; @@ -351,7 +351,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Bounds" detailTitle:[self LL_hierarchyPointDescription:self.bounds.origin]] noneInsets]; model3.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromCGRect(weakSelf.bounds) handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:NSStringFromCGRect(weakSelf.bounds) handler:^(NSString * _Nullable newText) { weakSelf.bounds = [weakSelf LL_rectFromString:newText originalRect:weakSelf.bounds]; }]; }; @@ -362,7 +362,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Center" detailTitle:[self LL_hierarchyPointDescription:self.center]] noneInsets]; model5.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromCGPoint(weakSelf.center) handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:NSStringFromCGPoint(weakSelf.center) handler:^(NSString * _Nullable newText) { weakSelf.center = [weakSelf LL_pointFromString:newText orginalPoint:weakSelf.center]; }]; }; @@ -370,7 +370,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Position" detailTitle:[self LL_hierarchyPointDescription:self.layer.position]] noneInsets]; model6.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromCGPoint(weakSelf.layer.position) handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:NSStringFromCGPoint(weakSelf.layer.position) handler:^(NSString * _Nullable newText) { weakSelf.layer.position = [weakSelf LL_pointFromString:newText orginalPoint:weakSelf.layer.position]; }]; }; @@ -378,7 +378,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:@"Z Position" detailTitle:[LLFormatterTool formatNumber:@(self.layer.zPosition)]]; model7.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.layer.zPosition)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.layer.zPosition)] handler:^(NSString * _Nullable newText) { weakSelf.layer.zPosition = [newText doubleValue]; }]; }; @@ -386,7 +386,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Anchor Point" detailTitle:[self LL_hierarchyPointDescription:self.layer.anchorPoint]] noneInsets]; model8.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromCGPoint(weakSelf.layer.anchorPoint) handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:NSStringFromCGPoint(weakSelf.layer.anchorPoint) handler:^(NSString * _Nullable newText) { weakSelf.layer.anchorPoint = [weakSelf LL_pointFromString:newText orginalPoint:weakSelf.layer.anchorPoint]; }]; }; @@ -394,7 +394,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Anchor Point Z" detailTitle:[LLFormatterTool formatNumber:@(self.layer.anchorPointZ)]]; model9.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.layer.anchorPointZ)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.layer.anchorPointZ)] handler:^(NSString * _Nullable newText) { weakSelf.layer.anchorPointZ = [newText doubleValue]; }]; }; @@ -411,7 +411,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *mod = [[[LLTitleCellModel alloc] initWithTitle:lastConstrainModel ? nil : @"Constrains" detailTitle:constrainDesc] noneInsets]; __weak NSLayoutConstraint *cons = constrain; mod.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(cons.constant)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(cons.constant)] handler:^(NSString * _Nullable newText) { cons.constant = [newText doubleValue]; }]; }; @@ -430,7 +430,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *mod = [[[LLTitleCellModel alloc] initWithTitle:lastConstrainModel ? nil : @"Constrains" detailTitle:constrainDesc] noneInsets]; __weak NSLayoutConstraint *cons = constrain; mod.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(cons.constant)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(cons.constant)] handler:^(NSString * _Nullable newText) { cons.constant = [newText doubleValue]; }]; }; @@ -493,7 +493,7 @@ @implementation UILabel (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Text" detailTitle:[self LL_hierarchyTextDescription:self.text]] noneInsets]; model1.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.text handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:weakSelf.text handler:^(NSString * _Nullable newText) { if (weakSelf.attributedText == nil) { weakSelf.text = newText; } else { @@ -514,7 +514,7 @@ @implementation UILabel (LL_Hierarchy) LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyObjectDescription:self.font]] noneInsets]; model4.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(weakSelf.font.pointSize)]] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(weakSelf.font.pointSize)]] handler:^(NSString * _Nullable newText) { weakSelf.font = [weakSelf.font fontWithSize:[newText doubleValue]]; }]; }; @@ -530,7 +530,7 @@ @implementation UILabel (LL_Hierarchy) LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Lines" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.numberOfLines]] noneInsets]; model6.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.numberOfLines] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.numberOfLines] handler:^(NSString * _Nullable newText) { weakSelf.numberOfLines = [newText integerValue]; }]; }; @@ -568,7 +568,7 @@ @implementation UILabel (LL_Hierarchy) LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:@"Min Font Scale" detailTitle:[LLFormatterTool formatNumber:@(self.minimumScaleFactor)]]; model11.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.minimumScaleFactor)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.minimumScaleFactor)] handler:^(NSString * _Nullable newText) { weakSelf.minimumScaleFactor = [newText doubleValue]; }]; }; @@ -588,7 +588,7 @@ @implementation UILabel (LL_Hierarchy) LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:self.shadowOffset]]; model14.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromCGSize(weakSelf.shadowOffset) handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:NSStringFromCGSize(weakSelf.shadowOffset) handler:^(NSString * _Nullable newText) { weakSelf.shadowOffset = [weakSelf LL_sizeFromString:newText originalSize:weakSelf.shadowOffset]; }]; }; @@ -680,7 +680,7 @@ @implementation UIButton (LL_Hierarchy) LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Title" detailTitle:[self LL_hierarchyTextDescription:self.currentTitle]] noneInsets]; model3.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.currentTitle handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:weakSelf.currentTitle handler:^(NSString * _Nullable newText) { [weakSelf setTitle:newText forState:weakSelf.state]; }]; }; @@ -691,7 +691,7 @@ @implementation UIButton (LL_Hierarchy) LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Text Color" detailTitle:[self LL_hierarchyColorDescription:self.currentTitleColor]] noneInsets]; model5.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[weakSelf.currentTitleColor LL_HexString] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[weakSelf.currentTitleColor LL_HexString] handler:^(NSString * _Nullable newText) { [weakSelf setTitleColor:[weakSelf LL_colorFromString:newText originalColor:weakSelf.currentTitleColor] forState:weakSelf.state]; }]; }; @@ -699,7 +699,7 @@ @implementation UIButton (LL_Hierarchy) LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Shadow Color" detailTitle:[self LL_hierarchyColorDescription:self.currentTitleShadowColor]]; model6.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[weakSelf.currentTitleShadowColor LL_HexString] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[weakSelf.currentTitleShadowColor LL_HexString] handler:^(NSString * _Nullable newText) { [weakSelf setTitleShadowColor:[weakSelf LL_colorFromString:newText originalColor:weakSelf.currentTitleShadowColor] forState:weakSelf.state]; }]; }; @@ -719,7 +719,7 @@ @implementation UIButton (LL_Hierarchy) #pragma clang diagnostic ignored "-Wdeprecated-declarations" LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:self.titleShadowOffset]] noneInsets]; model10.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromCGSize(weakSelf.titleShadowOffset) handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:NSStringFromCGSize(weakSelf.titleShadowOffset) handler:^(NSString * _Nullable newText) { weakSelf.titleShadowOffset = [self LL_sizeFromString:newText originalSize:weakSelf.titleShadowOffset]; }]; }; @@ -746,7 +746,7 @@ @implementation UIButton (LL_Hierarchy) LLTitleCellModel *model16 = [[[LLTitleCellModel alloc] initWithTitle:@"Content Insets" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.contentEdgeInsets]] noneInsets]; model16.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromUIEdgeInsets(weakSelf.contentEdgeInsets) handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:NSStringFromUIEdgeInsets(weakSelf.contentEdgeInsets) handler:^(NSString * _Nullable newText) { weakSelf.contentEdgeInsets = [weakSelf LL_insetsFromString:newText originalInsets:weakSelf.contentEdgeInsets]; }]; }; @@ -757,7 +757,7 @@ @implementation UIButton (LL_Hierarchy) LLTitleCellModel *model18 = [[[LLTitleCellModel alloc] initWithTitle:@"Title Insets" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.titleEdgeInsets]] noneInsets]; model18.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromUIEdgeInsets(weakSelf.titleEdgeInsets) handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:NSStringFromUIEdgeInsets(weakSelf.titleEdgeInsets) handler:^(NSString * _Nullable newText) { weakSelf.titleEdgeInsets = [weakSelf LL_insetsFromString:newText originalInsets:weakSelf.titleEdgeInsets]; }]; }; @@ -768,7 +768,7 @@ @implementation UIButton (LL_Hierarchy) LLTitleCellModel *model20 = [[[LLTitleCellModel alloc] initWithTitle:@"Image Insets" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.imageEdgeInsets]] noneInsets]; model20.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromUIEdgeInsets(weakSelf.imageEdgeInsets) handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:NSStringFromUIEdgeInsets(weakSelf.imageEdgeInsets) handler:^(NSString * _Nullable newText) { weakSelf.imageEdgeInsets = [weakSelf LL_insetsFromString:newText originalInsets:weakSelf.imageEdgeInsets]; }]; }; @@ -832,7 +832,7 @@ @implementation UITextField (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Plain Text" detailTitle:[self LL_hierarchyTextDescription:self.text]] noneInsets]; model1.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.text handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:weakSelf.text handler:^(NSString * _Nullable newText) { weakSelf.text = newText; }]; }; @@ -840,7 +840,7 @@ @implementation UITextField (LL_Hierarchy) LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Attributed Text" detailTitle:[self LL_hierarchyObjectDescription:self.attributedText]] noneInsets]; model2.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.attributedText.string handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:weakSelf.attributedText.string handler:^(NSString * _Nullable newText) { [weakSelf LL_replaceAttributeString:newText key:@"attributedText"]; }]; }; @@ -861,7 +861,7 @@ @implementation UITextField (LL_Hierarchy) LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Font" detailTitle:[self LL_hierarchyObjectDescription:self.font]] noneInsets]; model5.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(weakSelf.font.pointSize)]] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(weakSelf.font.pointSize)]] handler:^(NSString * _Nullable newText) { weakSelf.font = [weakSelf.font fontWithSize:[newText doubleValue]]; }]; }; @@ -877,7 +877,7 @@ @implementation UITextField (LL_Hierarchy) LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:@"Placeholder" detailTitle:[self LL_hierarchyTextDescription:self.placeholder ?: self.attributedPlaceholder.string]]; model7.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:(weakSelf.placeholder ?: weakSelf.attributedPlaceholder.string) handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:(weakSelf.placeholder ?: weakSelf.attributedPlaceholder.string) handler:^(NSString * _Nullable newText) { if (weakSelf.placeholder) { weakSelf.placeholder = newText; } else { @@ -918,7 +918,7 @@ @implementation UITextField (LL_Hierarchy) LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Font Size" detailTitle:[LLFormatterTool formatNumber:@(self.minimumFontSize)]] noneInsets]; model13.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.minimumFontSize)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.minimumFontSize)] handler:^(NSString * _Nullable newText) { weakSelf.minimumFontSize = [newText doubleValue]; }]; }; @@ -1031,7 +1031,7 @@ @implementation UISegmentedControl (LL_Hierarchy) if (@available(iOS 13.0, *)) { LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Large title" detailTitle:[self LL_hierarchyTextDescription:self.largeContentTitle]] noneInsets]; model4.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.largeContentTitle handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:weakSelf.largeContentTitle handler:^(NSString * _Nullable newText) { weakSelf.largeContentTitle = newText; }]; }; @@ -1079,7 +1079,7 @@ @implementation UISlider (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Current" detailTitle:[LLFormatterTool formatNumber:@(self.value)]] noneInsets]; model1.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.value)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.value)] handler:^(NSString * _Nullable newText) { weakSelf.value = [newText floatValue]; }]; }; @@ -1087,7 +1087,7 @@ @implementation UISlider (LL_Hierarchy) LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Minimum" detailTitle:[LLFormatterTool formatNumber:@(self.minimumValue)]] noneInsets]; model2.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(self.minimumValue)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(self.minimumValue)] handler:^(NSString * _Nullable newText) { weakSelf.minimumValue = [newText floatValue]; }]; }; @@ -1095,7 +1095,7 @@ @implementation UISlider (LL_Hierarchy) LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Maximum" detailTitle:[LLFormatterTool formatNumber:@(self.maximumValue)]]; model3.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(self.maximumValue)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(self.maximumValue)] handler:^(NSString * _Nullable newText) { weakSelf.maximumValue = [newText floatValue]; }]; }; @@ -1260,7 +1260,7 @@ @implementation UIProgressView (LL_Hierarchy) LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Progress" detailTitle:[LLFormatterTool formatNumber:@(self.progress)]]; model2.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.progress)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.progress)] handler:^(NSString * _Nullable newText) { weakSelf.progress = [newText floatValue]; }]; }; @@ -1305,7 +1305,7 @@ @implementation UIPageControl (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Pages" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.numberOfPages]] noneInsets]; model1.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.numberOfPages] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.numberOfPages] handler:^(NSString * _Nullable newText) { weakSelf.numberOfPages = [newText integerValue]; }]; }; @@ -1322,7 +1322,7 @@ @implementation UIPageControl (LL_Hierarchy) weakSelf.currentPage = index; }]; } else { - [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.currentPage] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.currentPage] handler:^(NSString * _Nullable newText) { weakSelf.currentPage = [newText integerValue]; }]; } @@ -1378,7 +1378,7 @@ @implementation UIStepper (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Value" detailTitle:[LLFormatterTool formatNumber:@(self.value)]] noneInsets]; model1.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.value)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.value)] handler:^(NSString * _Nullable newText) { weakSelf.value = [newText doubleValue]; }]; }; @@ -1386,7 +1386,7 @@ @implementation UIStepper (LL_Hierarchy) LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Minimum" detailTitle:[LLFormatterTool formatNumber:@(self.minimumValue)]] noneInsets]; model2.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.minimumValue)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.minimumValue)] handler:^(NSString * _Nullable newText) { weakSelf.minimumValue = [newText doubleValue]; }]; }; @@ -1394,7 +1394,7 @@ @implementation UIStepper (LL_Hierarchy) LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Maximum" detailTitle:[LLFormatterTool formatNumber:@(self.maximumValue)]] noneInsets]; model3.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.maximumValue)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.maximumValue)] handler:^(NSString * _Nullable newText) { weakSelf.maximumValue = [newText doubleValue]; }]; }; @@ -1402,7 +1402,7 @@ @implementation UIStepper (LL_Hierarchy) LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:@"Step" detailTitle:[LLFormatterTool formatNumber:@(self.stepValue)]]; model4.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.stepValue)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.stepValue)] handler:^(NSString * _Nullable newText) { weakSelf.stepValue = [newText doubleValue]; }]; }; @@ -1515,7 +1515,7 @@ @implementation UIScrollView (LL_Hierarchy) LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Zoom Min" detailTitle:[LLFormatterTool formatNumber:@(self.minimumZoomScale)]] noneInsets]; model10.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.minimumZoomScale)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.minimumZoomScale)] handler:^(NSString * _Nullable newText) { weakSelf.minimumZoomScale = [newText doubleValue]; }]; }; @@ -1523,7 +1523,7 @@ @implementation UIScrollView (LL_Hierarchy) LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:@"Max" detailTitle:[LLFormatterTool formatNumber:@(self.maximumZoomScale)]]; model11.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.maximumZoomScale)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.maximumZoomScale)] handler:^(NSString * _Nullable newText) { weakSelf.maximumZoomScale = [newText doubleValue]; }]; }; @@ -1601,7 +1601,7 @@ @implementation UITableView (LL_Hierarchy) LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Separator Inset" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.separatorInset]] noneInsets]; model7.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromUIEdgeInsets(weakSelf.separatorInset) handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:NSStringFromUIEdgeInsets(weakSelf.separatorInset) handler:^(NSString * _Nullable newText) { weakSelf.separatorInset = [weakSelf LL_insetsFromString:newText originalInsets:weakSelf.separatorInset]; }]; }; @@ -1650,7 +1650,7 @@ @implementation UITableView (LL_Hierarchy) LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Display" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.sectionIndexMinimumDisplayRowCount]] noneInsets]; model14.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%ld",(long)self.sectionIndexMinimumDisplayRowCount] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%ld",(long)self.sectionIndexMinimumDisplayRowCount] handler:^(NSString * _Nullable newText) { weakSelf.sectionIndexMinimumDisplayRowCount = [newText integerValue]; }]; }; @@ -1679,7 +1679,7 @@ @implementation UITableView (LL_Hierarchy) LLTitleCellModel *model18 = [[[LLTitleCellModel alloc] initWithTitle:@"Row Height" detailTitle:[LLFormatterTool formatNumber:@(self.rowHeight)]] noneInsets]; model18.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.rowHeight)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.rowHeight)] handler:^(NSString * _Nullable newText) { weakSelf.rowHeight = [newText doubleValue]; }]; }; @@ -1687,7 +1687,7 @@ @implementation UITableView (LL_Hierarchy) LLTitleCellModel *model19 = [[[LLTitleCellModel alloc] initWithTitle:@"Section Header" detailTitle:[LLFormatterTool formatNumber:@(self.sectionHeaderHeight)]] noneInsets]; model19.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(self.sectionHeaderHeight)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(self.sectionHeaderHeight)] handler:^(NSString * _Nullable newText) { weakSelf.sectionHeaderHeight = [newText doubleValue]; }]; }; @@ -1695,7 +1695,7 @@ @implementation UITableView (LL_Hierarchy) LLTitleCellModel *model20 = [[LLTitleCellModel alloc] initWithTitle:@"Section Footer" detailTitle:[LLFormatterTool formatNumber:@(self.sectionFooterHeight)]]; model20.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.sectionFooterHeight)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.sectionFooterHeight)] handler:^(NSString * _Nullable newText) { weakSelf.sectionFooterHeight = [newText doubleValue]; }]; }; @@ -1752,7 +1752,7 @@ @implementation UITableViewCell (LL_Hierarchy) LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Indentation" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.indentationLevel]] noneInsets]; model6.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.indentationLevel] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.indentationLevel] handler:^(NSString * _Nullable newText) { weakSelf.indentationLevel = [newText integerValue]; }]; }; @@ -1760,7 +1760,7 @@ @implementation UITableViewCell (LL_Hierarchy) LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[LLFormatterTool formatNumber:@(self.indentationWidth)]] noneInsets]; model7.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.indentationWidth)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.indentationWidth)] handler:^(NSString * _Nullable newText) { weakSelf.indentationWidth = [newText doubleValue]; }]; }; @@ -1782,7 +1782,7 @@ @implementation UITableViewCell (LL_Hierarchy) LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Separator Inset" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.separatorInset]] noneInsets]; model10.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:NSStringFromUIEdgeInsets(weakSelf.separatorInset) handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:NSStringFromUIEdgeInsets(weakSelf.separatorInset) handler:^(NSString * _Nullable newText) { weakSelf.separatorInset = [weakSelf LL_insetsFromString:newText originalInsets:weakSelf.separatorInset]; }]; }; @@ -1864,7 +1864,7 @@ @implementation UITextView (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Plain Text" detailTitle:[self LL_hierarchyTextDescription:self.text]] noneInsets]; model1.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.text handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:weakSelf.text handler:^(NSString * _Nullable newText) { weakSelf.text = newText; }]; }; @@ -1872,7 +1872,7 @@ @implementation UITextView (LL_Hierarchy) LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Attributed Text" detailTitle:[self LL_hierarchyObjectDescription:self.attributedText]] noneInsets]; model2.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.attributedText.string handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:weakSelf.attributedText.string handler:^(NSString * _Nullable newText) { [weakSelf LL_replaceAttributeString:newText key:@"attributedText"]; }]; }; @@ -1893,7 +1893,7 @@ @implementation UITextView (LL_Hierarchy) LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Font" detailTitle:[self LL_hierarchyObjectDescription:self.font]] noneInsets]; model5.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(weakSelf.font.pointSize)]] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(weakSelf.font.pointSize)]] handler:^(NSString * _Nullable newText) { weakSelf.font = [weakSelf.font fontWithSize:[newText doubleValue]]; }]; }; @@ -2081,7 +2081,7 @@ @implementation UIDatePicker (LL_Hierarchy) LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Interval" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.minuteInterval]]; model3.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.minuteInterval] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.minuteInterval] handler:^(NSString * _Nullable newText) { weakSelf.minuteInterval = [newText integerValue]; }]; }; @@ -2089,7 +2089,7 @@ @implementation UIDatePicker (LL_Hierarchy) LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Date" detailTitle:[self LL_hierarchyDateDescription:self.date]] noneInsets]; model4.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool stringFromDate:weakSelf.date style:FormatterToolDateStyle3] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool stringFromDate:weakSelf.date style:FormatterToolDateStyle3] handler:^(NSString * _Nullable newText) { NSDate *newDate = [LLFormatterTool dateFromString:newText style:FormatterToolDateStyle3]; if (newDate) { weakSelf.date = newDate; @@ -2100,7 +2100,7 @@ @implementation UIDatePicker (LL_Hierarchy) LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Date" detailTitle:[self LL_hierarchyDateDescription:self.minimumDate]] noneInsets]; model5.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool stringFromDate:weakSelf.minimumDate style:FormatterToolDateStyle3] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool stringFromDate:weakSelf.minimumDate style:FormatterToolDateStyle3] handler:^(NSString * _Nullable newText) { NSDate *newDate = [LLFormatterTool dateFromString:newText style:FormatterToolDateStyle3]; if (newDate) { weakSelf.minimumDate = newDate; @@ -2111,7 +2111,7 @@ @implementation UIDatePicker (LL_Hierarchy) LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Max Date" detailTitle:[self LL_hierarchyDateDescription:self.maximumDate]]; model6.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool stringFromDate:weakSelf.maximumDate style:FormatterToolDateStyle3] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool stringFromDate:weakSelf.maximumDate style:FormatterToolDateStyle3] handler:^(NSString * _Nullable newText) { NSDate *newDate = [LLFormatterTool dateFromString:newText style:FormatterToolDateStyle3]; if (newDate) { weakSelf.maximumDate = newDate; @@ -2213,7 +2213,7 @@ @implementation UINavigationBar (LL_Hierarchy) if (!font) { return; } - [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(font.pointSize)]] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(font.pointSize)]] handler:^(NSString * _Nullable newText) { NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithDictionary:weakSelf.titleTextAttributes]; attributes[NSFontAttributeName] = [font fontWithSize:[newText doubleValue]]; weakSelf.titleTextAttributes = [attributes copy]; @@ -2247,7 +2247,7 @@ @implementation UINavigationBar (LL_Hierarchy) if (!font) { return; } - [weakSelf LL_showHierarchyChangeAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(font.pointSize)]] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(font.pointSize)]] handler:^(NSString * _Nullable newText) { NSMutableDictionary *attributes = [[NSMutableDictionary alloc] initWithDictionary:weakSelf.largeTitleTextAttributes]; attributes[NSFontAttributeName] = [font fontWithSize:[newText doubleValue]]; weakSelf.largeTitleTextAttributes = [attributes copy]; @@ -2371,7 +2371,7 @@ @implementation UITabBar (LL_Hierarchy) LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Item Width" detailTitle:[LLFormatterTool formatNumber:@(self.itemWidth)]] noneInsets]; model8.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.itemWidth)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.itemWidth)] handler:^(NSString * _Nullable newText) { weakSelf.itemWidth = [newText doubleValue]; }]; }; @@ -2379,7 +2379,7 @@ @implementation UITabBar (LL_Hierarchy) LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Item Spacing" detailTitle:[LLFormatterTool formatNumber:@(self.itemSpacing)]]; model9.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.itemSpacing)] handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.itemSpacing)] handler:^(NSString * _Nullable newText) { weakSelf.itemSpacing = [newText doubleValue]; }]; }; @@ -2406,7 +2406,7 @@ @implementation UISearchBar (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Text" detailTitle:[self LL_hierarchyTextDescription:self.text]] noneInsets]; model1.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.text handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:weakSelf.text handler:^(NSString * _Nullable newText) { weakSelf.text = newText; }]; }; @@ -2414,7 +2414,7 @@ @implementation UISearchBar (LL_Hierarchy) LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Placeholder" detailTitle:[self LL_hierarchyTextDescription:self.placeholder]] noneInsets]; model2.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.placeholder handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:weakSelf.placeholder handler:^(NSString * _Nullable newText) { weakSelf.placeholder = newText; }]; }; @@ -2422,7 +2422,7 @@ @implementation UISearchBar (LL_Hierarchy) LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Prompt" detailTitle:[self LL_hierarchyTextDescription:self.prompt]]; model3.block = ^{ - [weakSelf LL_showHierarchyChangeAlertWithText:weakSelf.prompt handler:^(NSString * _Nullable newText) { + [weakSelf LL_showTextFieldAlertWithText:weakSelf.prompt handler:^(NSString * _Nullable newText) { weakSelf.prompt = newText; }]; }; From af3aa251f50a6b60c04946ceacb23908220cad9c Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Thu, 31 Oct 2019 13:40:15 +0800 Subject: [PATCH 39/45] Refactory. --- .../Function/NSObject+LL_Hierarchy.m | 404 ++++++++---------- 1 file changed, 183 insertions(+), 221 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 4c95fe07..5dc4cc2b 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -73,17 +73,6 @@ - (UIColor *)LL_colorFromString:(NSString *)string originalColor:(UIColor *)colo return newColor; } -- (void)LL_showColorAlertAndAutomicSetWithKey:(NSString *)key { - __block UIColor *color = [self valueForKey:key]; - if (color && ![color isKindOfClass:[UIColor class]]) { - return; - } - __weak typeof(self) weakSelf = self; - [self LL_showTextFieldAlertWithText:[color LL_HexString] handler:^(NSString * _Nullable newText) { - [weakSelf setValue:[weakSelf LL_colorFromString:newText originalColor:color] forKey:key]; - }]; -} - - (NSString *)LL_hierarchyBoolDescription:(BOOL)flag { return flag ? @"On" : @"Off"; } @@ -135,6 +124,11 @@ - (NSString *)LL_hierarchySizeDescription:(CGSize)size { - (CGRect)LL_rectFromString:(NSString *)string originalRect:(CGRect)rect { CGRect newRect = CGRectFromString(string); + if (CGRectEqualToRect(newRect, CGRectZero) && ![string isEqualToString:NSStringFromCGRect(CGRectZero)]) { + // Wrong text. + [LLTool log:@"Input a wrong rect string."]; + return rect; + } return newRect; } @@ -170,6 +164,99 @@ - (NSString *)LL_hierarchyOffsetDescription:(UIOffset)offset { return [NSString stringWithFormat:@"h %@ v %@",[LLFormatterTool formatNumber:@(offset.horizontal)], [LLFormatterTool formatNumber:@(offset.vertical)]]; } +- (void)LL_showIntAlertAndAutomicSetWithKeyPath:(NSString *)keyPath { + __weak typeof(self) weakSelf = self; + [self LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%@",[self valueForKeyPath:keyPath]] handler:^(NSString * _Nullable newText) { + [weakSelf setValue:@([newText integerValue]) forKeyPath:keyPath]; + }]; +} + +- (void)LL_showDoubleAlertAndAutomicSetWithKeyPath:(NSString *)keyPath { + __weak typeof(self) weakSelf = self; + [self LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:[self valueForKeyPath:keyPath]] handler:^(NSString * _Nullable newText) { + [weakSelf setValue:@([newText doubleValue]) forKeyPath:keyPath]; + }]; +} + +- (void)LL_showColorAlertAndAutomicSetWithKeyPath:(NSString *)keyPath { + __block UIColor *color = [self valueForKeyPath:keyPath]; + if (color && ![color isKindOfClass:[UIColor class]]) { + return; + } + __weak typeof(self) weakSelf = self; + [self LL_showTextFieldAlertWithText:[color LL_HexString] handler:^(NSString * _Nullable newText) { + [weakSelf setValue:[weakSelf LL_colorFromString:newText originalColor:color] forKeyPath:keyPath]; + }]; +} + +- (void)LL_showFrameAlertAndAutomicSetWithKeyPath:(NSString *)keyPath { + __block NSValue *value = [self valueForKeyPath:keyPath]; + __weak typeof(self) weakSelf = self; + [self LL_showTextFieldAlertWithText:NSStringFromCGRect([value CGRectValue]) handler:^(NSString * _Nullable newText) { + [weakSelf setValue:[NSValue valueWithCGRect:[weakSelf LL_rectFromString:newText originalRect:[value CGRectValue]]] forKeyPath:keyPath]; + }]; +} + +- (void)LL_showPointAlertAndAutomicSetWithKeyPath:(NSString *)keyPath { + __block NSValue *value = [self valueForKeyPath:keyPath]; + __weak typeof(self) weakSelf = self; + [self LL_showTextFieldAlertWithText:NSStringFromCGPoint([value CGPointValue]) handler:^(NSString * _Nullable newText) { + [weakSelf setValue:[NSValue valueWithCGPoint:[weakSelf LL_pointFromString:newText orginalPoint:[value CGPointValue]]] forKeyPath:keyPath]; + }]; +} + +- (void)LL_showEdgeInsetsAndAutomicSetWithKeyPath:(NSString *)keyPath { + __block NSValue *value = [self valueForKeyPath:keyPath]; + __weak typeof(self) weakSelf = self; + [self LL_showTextFieldAlertWithText:NSStringFromUIEdgeInsets([value UIEdgeInsetsValue]) handler:^(NSString * _Nullable newText) { + [weakSelf setValue:[NSValue valueWithUIEdgeInsets:[weakSelf LL_insetsFromString:newText originalInsets:[value UIEdgeInsetsValue]]] forKeyPath:keyPath]; + }]; +} + +- (void)LL_showTextAlertAndAutomicSetWithKeyPath:(NSString *)keyPath { + __weak typeof(self) weakSelf = self; + [self LL_showTextFieldAlertWithText:[self valueForKeyPath:keyPath] handler:^(NSString * _Nullable newText) { + [weakSelf setValue:newText forKeyPath:keyPath]; + }]; +} + +- (void)LL_showAttributeTextAlertAndAutomicSetWithKeyPath:(NSString *)keyPath { + __block NSAttributedString *attribute = [self valueForKeyPath:keyPath]; + __weak typeof(self) weakSelf = self; + [self LL_showTextFieldAlertWithText:attribute.string handler:^(NSString * _Nullable newText) { + NSMutableAttributedString *mutAttribute = [[NSMutableAttributedString alloc] initWithAttributedString:attribute]; + [mutAttribute replaceCharactersInRange:NSMakeRange(0, attribute.string.length) withString:newText]; + [weakSelf setValue:[mutAttribute copy] forKeyPath:keyPath]; + }]; +} + +- (void)LL_showSizeAlertAndAutomicSetWithKeyPath:(NSString *)keyPath { + __block NSValue *value = [self valueForKeyPath:keyPath]; + __weak typeof(self) weakSelf = self; + [self LL_showTextFieldAlertWithText:NSStringFromCGSize([value CGSizeValue]) handler:^(NSString * _Nullable newText) { + [weakSelf setValue:[NSValue valueWithCGSize:[weakSelf LL_sizeFromString:newText originalSize:[value CGSizeValue]]] forKeyPath:keyPath]; + }]; +} + +- (void)LL_showFontAlertAndAutomicSetWithKeyPath:(NSString *)keyPath { + __block UIFont *font = [self valueForKeyPath:keyPath]; + __weak typeof(self) weakSelf = self; + [self LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(font.pointSize)] handler:^(NSString * _Nullable newText) { + [weakSelf setValue:[font fontWithSize:[newText doubleValue]] forKeyPath:keyPath]; + }]; +} + +- (void)LL_showDateAlertAndAutomicSetWithKeyPath:(NSString *)keyPath { + NSDate *date = [self valueForKeyPath:keyPath]; + __weak typeof(self) weakSelf = self; + [self LL_showTextFieldAlertWithText:[LLFormatterTool stringFromDate:date style:FormatterToolDateStyle3] handler:^(NSString * _Nullable newText) { + NSDate *newDate = [LLFormatterTool dateFromString:newText style:FormatterToolDateStyle3]; + if (newDate) { + [weakSelf setValue:newDate forKeyPath:keyPath]; + } + }]; +} + - (void)LL_showTextFieldAlertWithText:(NSString *)text handler:(nullable void (^)(NSString * _Nullable newText))handler { [[LLTool keyWindow].rootViewController.LL_currentShowingViewController LL_showTextFieldAlertControllerWithMessage:@"Change Property" text:text handler:^(NSString * _Nullable newText) { if (handler) { @@ -229,9 +316,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:@"Tag" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.tag]]; model4.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.tag] handler:^(NSString * _Nullable newText) { - weakSelf.tag = [newText integerValue]; - }]; + [weakSelf LL_showIntAlertAndAutomicSetWithKeyPath:@"tag"]; }; [settings addObject:model4]; @@ -251,21 +336,19 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Alpha" detailTitle:[LLFormatterTool formatNumber:@(self.alpha)]] noneInsets]; model7.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(self.alpha)] handler:^(NSString * _Nullable newText) { - weakSelf.alpha = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"alpha"]; }; [settings addObject:model7]; LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Background" detailTitle:[self LL_hierarchyColorDescription:self.backgroundColor]] noneInsets]; model8.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"backgroundColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"backgroundColor"]; }; [settings addObject:model8]; LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Tint" detailTitle:[self LL_hierarchyColorDescription:self.tintColor]]; model9.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"tintColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"tintColor"]; }; [settings addObject:model9]; @@ -340,9 +423,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Frame" detailTitle:[self LL_hierarchyPointDescription:self.frame.origin]] noneInsets]; model1.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:NSStringFromCGRect(weakSelf.frame) handler:^(NSString * _Nullable newText) { - weakSelf.frame = [weakSelf LL_rectFromString:newText originalRect:weakSelf.frame]; - }]; + [weakSelf LL_showFrameAlertAndAutomicSetWithKeyPath:@"frame"]; }; [settings addObject:model1]; @@ -351,9 +432,7 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Bounds" detailTitle:[self LL_hierarchyPointDescription:self.bounds.origin]] noneInsets]; model3.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:NSStringFromCGRect(weakSelf.bounds) handler:^(NSString * _Nullable newText) { - weakSelf.bounds = [weakSelf LL_rectFromString:newText originalRect:weakSelf.bounds]; - }]; + [weakSelf LL_showFrameAlertAndAutomicSetWithKeyPath:@"bounds"]; }; [settings addObject:model3]; @@ -362,41 +441,31 @@ @implementation UIView (LL_Hierarchy) LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Center" detailTitle:[self LL_hierarchyPointDescription:self.center]] noneInsets]; model5.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:NSStringFromCGPoint(weakSelf.center) handler:^(NSString * _Nullable newText) { - weakSelf.center = [weakSelf LL_pointFromString:newText orginalPoint:weakSelf.center]; - }]; + [weakSelf LL_showPointAlertAndAutomicSetWithKeyPath:@"center"]; }; [settings addObject:model5]; LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Position" detailTitle:[self LL_hierarchyPointDescription:self.layer.position]] noneInsets]; model6.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:NSStringFromCGPoint(weakSelf.layer.position) handler:^(NSString * _Nullable newText) { - weakSelf.layer.position = [weakSelf LL_pointFromString:newText orginalPoint:weakSelf.layer.position]; - }]; + [weakSelf LL_showPointAlertAndAutomicSetWithKeyPath:@"layer.position"]; }; [settings addObject:model6]; LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:@"Z Position" detailTitle:[LLFormatterTool formatNumber:@(self.layer.zPosition)]]; model7.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.layer.zPosition)] handler:^(NSString * _Nullable newText) { - weakSelf.layer.zPosition = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"layer.zPosition"]; }; [settings addObject:model7]; LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Anchor Point" detailTitle:[self LL_hierarchyPointDescription:self.layer.anchorPoint]] noneInsets]; model8.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:NSStringFromCGPoint(weakSelf.layer.anchorPoint) handler:^(NSString * _Nullable newText) { - weakSelf.layer.anchorPoint = [weakSelf LL_pointFromString:newText orginalPoint:weakSelf.layer.anchorPoint]; - }]; + [weakSelf LL_showPointAlertAndAutomicSetWithKeyPath:@"layer.anchorPoint"]; }; [settings addObject:model8]; LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Anchor Point Z" detailTitle:[LLFormatterTool formatNumber:@(self.layer.anchorPointZ)]]; model9.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.layer.anchorPointZ)] handler:^(NSString * _Nullable newText) { - weakSelf.layer.anchorPointZ = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"layer.anchorPointZ"]; }; [settings addObject:model9]; @@ -493,13 +562,7 @@ @implementation UILabel (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Text" detailTitle:[self LL_hierarchyTextDescription:self.text]] noneInsets]; model1.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:weakSelf.text handler:^(NSString * _Nullable newText) { - if (weakSelf.attributedText == nil) { - weakSelf.text = newText; - } else { - [weakSelf LL_replaceAttributeString:newText key:@"attributedText"]; - } - }]; + [weakSelf LL_showTextAlertAndAutomicSetWithKeyPath:@"text"]; }; [settings addObject:model1]; @@ -508,15 +571,13 @@ @implementation UILabel (LL_Hierarchy) LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Text" detailTitle:[self LL_hierarchyColorDescription:self.textColor]] noneInsets]; model3.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"textColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"textColor"]; }; [settings addObject:model3]; LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyObjectDescription:self.font]] noneInsets]; model4.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(weakSelf.font.pointSize)]] handler:^(NSString * _Nullable newText) { - weakSelf.font = [weakSelf.font fontWithSize:[newText doubleValue]]; - }]; + [weakSelf LL_showFontAlertAndAutomicSetWithKeyPath:@"font"]; }; [settings addObject:model4]; @@ -530,9 +591,7 @@ @implementation UILabel (LL_Hierarchy) LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Lines" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.numberOfLines]] noneInsets]; model6.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.numberOfLines] handler:^(NSString * _Nullable newText) { - weakSelf.numberOfLines = [newText integerValue]; - }]; + [weakSelf LL_showIntAlertAndAutomicSetWithKeyPath:@"numberOfLines"]; }; [settings addObject:model6]; @@ -568,29 +627,25 @@ @implementation UILabel (LL_Hierarchy) LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:@"Min Font Scale" detailTitle:[LLFormatterTool formatNumber:@(self.minimumScaleFactor)]]; model11.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.minimumScaleFactor)] handler:^(NSString * _Nullable newText) { - weakSelf.minimumScaleFactor = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"minimumScaleFactor"]; }; [settings addObject:model11]; LLTitleCellModel *model12 = [[[LLTitleCellModel alloc] initWithTitle:@"Highlighted" detailTitle:[self LL_hierarchyColorDescription:self.highlightedTextColor]] noneInsets]; model12.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"highlightedTextColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"highlightedTextColor"]; }; [settings addObject:model12]; LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:@"Shadow" detailTitle:[self LL_hierarchyColorDescription:self.shadowColor]] noneInsets]; model13.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"shadowColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"shadowColor"]; }; [settings addObject:model13]; LLTitleCellModel *model14 = [[LLTitleCellModel alloc] initWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:self.shadowOffset]]; model14.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:NSStringFromCGSize(weakSelf.shadowOffset) handler:^(NSString * _Nullable newText) { - weakSelf.shadowOffset = [weakSelf LL_sizeFromString:newText originalSize:weakSelf.shadowOffset]; - }]; + [weakSelf LL_showSizeAlertAndAutomicSetWithKeyPath:@"shadowOffset"]; }; [settings addObject:model14]; @@ -719,9 +774,7 @@ @implementation UIButton (LL_Hierarchy) #pragma clang diagnostic ignored "-Wdeprecated-declarations" LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Shadow Offset" detailTitle:[self LL_hierarchySizeDescription:self.titleShadowOffset]] noneInsets]; model10.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:NSStringFromCGSize(weakSelf.titleShadowOffset) handler:^(NSString * _Nullable newText) { - weakSelf.titleShadowOffset = [self LL_sizeFromString:newText originalSize:weakSelf.titleShadowOffset]; - }]; + [weakSelf LL_showSizeAlertAndAutomicSetWithKeyPath:@"titleShadowOffset"]; }; [settings addObject:model10]; #pragma clang diagnostic pop @@ -746,9 +799,7 @@ @implementation UIButton (LL_Hierarchy) LLTitleCellModel *model16 = [[[LLTitleCellModel alloc] initWithTitle:@"Content Insets" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.contentEdgeInsets]] noneInsets]; model16.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:NSStringFromUIEdgeInsets(weakSelf.contentEdgeInsets) handler:^(NSString * _Nullable newText) { - weakSelf.contentEdgeInsets = [weakSelf LL_insetsFromString:newText originalInsets:weakSelf.contentEdgeInsets]; - }]; + [weakSelf LL_showEdgeInsetsAndAutomicSetWithKeyPath:@"contentEdgeInsets"]; }; [settings addObject:model16]; @@ -757,9 +808,7 @@ @implementation UIButton (LL_Hierarchy) LLTitleCellModel *model18 = [[[LLTitleCellModel alloc] initWithTitle:@"Title Insets" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.titleEdgeInsets]] noneInsets]; model18.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:NSStringFromUIEdgeInsets(weakSelf.titleEdgeInsets) handler:^(NSString * _Nullable newText) { - weakSelf.titleEdgeInsets = [weakSelf LL_insetsFromString:newText originalInsets:weakSelf.titleEdgeInsets]; - }]; + [weakSelf LL_showEdgeInsetsAndAutomicSetWithKeyPath:@"titleEdgeInsets"]; }; [settings addObject:model18]; @@ -768,9 +817,7 @@ @implementation UIButton (LL_Hierarchy) LLTitleCellModel *model20 = [[[LLTitleCellModel alloc] initWithTitle:@"Image Insets" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.imageEdgeInsets]] noneInsets]; model20.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:NSStringFromUIEdgeInsets(weakSelf.imageEdgeInsets) handler:^(NSString * _Nullable newText) { - weakSelf.imageEdgeInsets = [weakSelf LL_insetsFromString:newText originalInsets:weakSelf.imageEdgeInsets]; - }]; + [weakSelf LL_showEdgeInsetsAndAutomicSetWithKeyPath:@"imageEdgeInsets"]; }; [settings addObject:model20]; @@ -832,17 +879,13 @@ @implementation UITextField (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Plain Text" detailTitle:[self LL_hierarchyTextDescription:self.text]] noneInsets]; model1.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:weakSelf.text handler:^(NSString * _Nullable newText) { - weakSelf.text = newText; - }]; + [weakSelf LL_showTextAlertAndAutomicSetWithKeyPath:@"text"]; }; [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Attributed Text" detailTitle:[self LL_hierarchyObjectDescription:self.attributedText]] noneInsets]; model2.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:weakSelf.attributedText.string handler:^(NSString * _Nullable newText) { - [weakSelf LL_replaceAttributeString:newText key:@"attributedText"]; - }]; + [weakSelf LL_showAttributeTextAlertAndAutomicSetWithKeyPath:@"attributedText"]; }; [settings addObject:model2]; @@ -855,15 +898,13 @@ @implementation UITextField (LL_Hierarchy) LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.textColor]] noneInsets]; model4.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"textColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"textColor"]; }; [settings addObject:model4]; LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Font" detailTitle:[self LL_hierarchyObjectDescription:self.font]] noneInsets]; model5.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(weakSelf.font.pointSize)]] handler:^(NSString * _Nullable newText) { - weakSelf.font = [weakSelf.font fontWithSize:[newText doubleValue]]; - }]; + [weakSelf LL_showFontAlertAndAutomicSetWithKeyPath:@"font"]; }; [settings addObject:model5]; @@ -877,13 +918,11 @@ @implementation UITextField (LL_Hierarchy) LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:@"Placeholder" detailTitle:[self LL_hierarchyTextDescription:self.placeholder ?: self.attributedPlaceholder.string]]; model7.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:(weakSelf.placeholder ?: weakSelf.attributedPlaceholder.string) handler:^(NSString * _Nullable newText) { - if (weakSelf.placeholder) { - weakSelf.placeholder = newText; - } else { - [weakSelf LL_replaceAttributeString:newText key:@"attributedPlaceholder"]; - } - }]; + if (weakSelf.placeholder) { + [weakSelf LL_showTextAlertAndAutomicSetWithKeyPath:@"placeholder"]; + } else { + [weakSelf LL_showAttributeTextAlertAndAutomicSetWithKeyPath:@"attributedPlaceholder"]; + } }; [settings addObject:model7]; @@ -918,9 +957,7 @@ @implementation UITextField (LL_Hierarchy) LLTitleCellModel *model13 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Font Size" detailTitle:[LLFormatterTool formatNumber:@(self.minimumFontSize)]] noneInsets]; model13.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.minimumFontSize)] handler:^(NSString * _Nullable newText) { - weakSelf.minimumFontSize = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"minimumFontSize"]; }; [settings addObject:model13]; @@ -1031,9 +1068,7 @@ @implementation UISegmentedControl (LL_Hierarchy) if (@available(iOS 13.0, *)) { LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Large title" detailTitle:[self LL_hierarchyTextDescription:self.largeContentTitle]] noneInsets]; model4.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:weakSelf.largeContentTitle handler:^(NSString * _Nullable newText) { - weakSelf.largeContentTitle = newText; - }]; + [weakSelf LL_showTextAlertAndAutomicSetWithKeyPath:@"largeContentTitle"]; }; [settings addObject:model4]; @@ -1079,25 +1114,19 @@ @implementation UISlider (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Current" detailTitle:[LLFormatterTool formatNumber:@(self.value)]] noneInsets]; model1.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.value)] handler:^(NSString * _Nullable newText) { - weakSelf.value = [newText floatValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"value"]; }; [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Minimum" detailTitle:[LLFormatterTool formatNumber:@(self.minimumValue)]] noneInsets]; model2.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(self.minimumValue)] handler:^(NSString * _Nullable newText) { - weakSelf.minimumValue = [newText floatValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"minimumValue"]; }; [settings addObject:model2]; LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Maximum" detailTitle:[LLFormatterTool formatNumber:@(self.maximumValue)]]; model3.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(self.maximumValue)] handler:^(NSString * _Nullable newText) { - weakSelf.maximumValue = [newText floatValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"maximumValue"]; }; [settings addObject:model3]; @@ -1109,19 +1138,19 @@ @implementation UISlider (LL_Hierarchy) LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Track Tint" detailTitle:[self LL_hierarchyColorDescription:self.minimumTrackTintColor]] noneInsets]; model6.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"minimumTrackTintColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"minimumTrackTintColor"]; }; [settings addObject:model6]; LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Max Track Tint" detailTitle:[self LL_hierarchyColorDescription:self.maximumTrackTintColor]] noneInsets]; model7.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"maximumTrackTintColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"maximumTrackTintColor"]; }; [settings addObject:model7]; LLTitleCellModel *model8 = [[LLTitleCellModel alloc] initWithTitle:@"Thumb Tint" detailTitle:[self LL_hierarchyColorDescription:self.tintColor]]; model8.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"tintColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"tintColor"]; }; [settings addObject:model8]; @@ -1160,13 +1189,13 @@ @implementation UISwitch (LL_Hierarchy) LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"On Tint" detailTitle:[self LL_hierarchyColorDescription:self.onTintColor]] noneInsets]; model2.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"onTintColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"onTintColor"]; }; [settings addObject:model2]; LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Thumb Tint" detailTitle:[self LL_hierarchyColorDescription:self.thumbTintColor]]; model3.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"thumbTintColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"thumbTintColor"]; }; [settings addObject:model3]; @@ -1205,7 +1234,7 @@ @implementation UIActivityIndicatorView (LL_Hierarchy) LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.color]] noneInsets]; model2.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"color"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"color"]; }; [settings addObject:model2]; @@ -1260,21 +1289,19 @@ @implementation UIProgressView (LL_Hierarchy) LLTitleCellModel *model2 = [[LLTitleCellModel alloc] initWithTitle:@"Progress" detailTitle:[LLFormatterTool formatNumber:@(self.progress)]]; model2.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.progress)] handler:^(NSString * _Nullable newText) { - weakSelf.progress = [newText floatValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"progress"]; }; [settings addObject:model2]; LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Progress Tint" detailTitle:[self LL_hierarchyColorDescription:self.progressTintColor]] noneInsets]; model3.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"progressTintColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"progressTintColor"]; }; [settings addObject:model3]; LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:@"Track Tint" detailTitle:[self LL_hierarchyColorDescription:self.trackTintColor]]; model4.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"trackTintColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"trackTintColor"]; }; [settings addObject:model4]; @@ -1305,9 +1332,7 @@ @implementation UIPageControl (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Pages" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.numberOfPages]] noneInsets]; model1.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.numberOfPages] handler:^(NSString * _Nullable newText) { - weakSelf.numberOfPages = [newText integerValue]; - }]; + [weakSelf LL_showIntAlertAndAutomicSetWithKeyPath:@"numberOfPages"]; }; [settings addObject:model1]; @@ -1322,9 +1347,7 @@ @implementation UIPageControl (LL_Hierarchy) weakSelf.currentPage = index; }]; } else { - [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.currentPage] handler:^(NSString * _Nullable newText) { - weakSelf.currentPage = [newText integerValue]; - }]; + [weakSelf LL_showIntAlertAndAutomicSetWithKeyPath:@"currentPage"]; } }; [settings addObject:model2]; @@ -1345,13 +1368,13 @@ @implementation UIPageControl (LL_Hierarchy) LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Tint Color" detailTitle:[self LL_hierarchyColorDescription:self.pageIndicatorTintColor]] noneInsets]; model5.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"pageIndicatorTintColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"pageIndicatorTintColor"]; }; [settings addObject:model5]; LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Current Page" detailTitle:[self LL_hierarchyColorDescription:self.currentPageIndicatorTintColor]]; model6.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"currentPageIndicatorTintColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"currentPageIndicatorTintColor"]; }; [settings addObject:model6]; @@ -1378,33 +1401,25 @@ @implementation UIStepper (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Value" detailTitle:[LLFormatterTool formatNumber:@(self.value)]] noneInsets]; model1.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.value)] handler:^(NSString * _Nullable newText) { - weakSelf.value = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"value"]; }; [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Minimum" detailTitle:[LLFormatterTool formatNumber:@(self.minimumValue)]] noneInsets]; model2.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.minimumValue)] handler:^(NSString * _Nullable newText) { - weakSelf.minimumValue = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"minimumValue"]; }; [settings addObject:model2]; LLTitleCellModel *model3 = [[[LLTitleCellModel alloc] initWithTitle:@"Maximum" detailTitle:[LLFormatterTool formatNumber:@(self.maximumValue)]] noneInsets]; model3.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.maximumValue)] handler:^(NSString * _Nullable newText) { - weakSelf.maximumValue = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"maximumValue"]; }; [settings addObject:model3]; LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:@"Step" detailTitle:[LLFormatterTool formatNumber:@(self.stepValue)]]; model4.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.stepValue)] handler:^(NSString * _Nullable newText) { - weakSelf.stepValue = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"stepValue"]; }; [settings addObject:model4]; @@ -1515,17 +1530,13 @@ @implementation UIScrollView (LL_Hierarchy) LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Zoom Min" detailTitle:[LLFormatterTool formatNumber:@(self.minimumZoomScale)]] noneInsets]; model10.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.minimumZoomScale)] handler:^(NSString * _Nullable newText) { - weakSelf.minimumZoomScale = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"minimumZoomScale"]; }; [settings addObject:model10]; LLTitleCellModel *model11 = [[LLTitleCellModel alloc] initWithTitle:@"Max" detailTitle:[LLFormatterTool formatNumber:@(self.maximumZoomScale)]]; model11.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.maximumZoomScale)] handler:^(NSString * _Nullable newText) { - weakSelf.maximumZoomScale = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"maximumZoomScale"]; }; [settings addObject:model11]; @@ -1589,7 +1600,7 @@ @implementation UITableView (LL_Hierarchy) LLTitleCellModel *model4 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyColorDescription:self.separatorColor]]; model4.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"separatorColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"separatorColor"]; }; [settings addObject:model4]; @@ -1601,9 +1612,7 @@ @implementation UITableView (LL_Hierarchy) LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:@"Separator Inset" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.separatorInset]] noneInsets]; model7.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:NSStringFromUIEdgeInsets(weakSelf.separatorInset) handler:^(NSString * _Nullable newText) { - weakSelf.separatorInset = [weakSelf LL_insetsFromString:newText originalInsets:weakSelf.separatorInset]; - }]; + [weakSelf LL_showEdgeInsetsAndAutomicSetWithKeyPath:@"separatorInset"]; }; [settings addObject:model7]; @@ -1650,27 +1659,25 @@ @implementation UITableView (LL_Hierarchy) LLTitleCellModel *model14 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Display" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.sectionIndexMinimumDisplayRowCount]] noneInsets]; model14.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%ld",(long)self.sectionIndexMinimumDisplayRowCount] handler:^(NSString * _Nullable newText) { - weakSelf.sectionIndexMinimumDisplayRowCount = [newText integerValue]; - }]; + [weakSelf LL_showIntAlertAndAutomicSetWithKeyPath:@"sectionIndexMinimumDisplayRowCount"]; }; [settings addObject:model14]; LLTitleCellModel *model15 = [[[LLTitleCellModel alloc] initWithTitle:@"Text" detailTitle:[self LL_hierarchyColorDescription:self.sectionIndexColor]] noneInsets]; model15.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"sectionIndexColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"sectionIndexColor"]; }; [settings addObject:model15]; LLTitleCellModel *model16 = [[[LLTitleCellModel alloc] initWithTitle:@"Background" detailTitle:[self LL_hierarchyColorDescription:self.sectionIndexBackgroundColor]] noneInsets]; model16.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"sectionIndexBackgroundColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"sectionIndexBackgroundColor"]; }; [settings addObject:model16]; LLTitleCellModel *model17 = [[LLTitleCellModel alloc] initWithTitle:@"Tracking" detailTitle:[self LL_hierarchyColorDescription:self.sectionIndexTrackingBackgroundColor]]; model17.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"sectionIndexTrackingBackgroundColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"sectionIndexTrackingBackgroundColor"]; }; model17.block = ^{ @@ -1679,25 +1686,19 @@ @implementation UITableView (LL_Hierarchy) LLTitleCellModel *model18 = [[[LLTitleCellModel alloc] initWithTitle:@"Row Height" detailTitle:[LLFormatterTool formatNumber:@(self.rowHeight)]] noneInsets]; model18.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.rowHeight)] handler:^(NSString * _Nullable newText) { - weakSelf.rowHeight = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"rowHeight"]; }; [settings addObject:model18]; LLTitleCellModel *model19 = [[[LLTitleCellModel alloc] initWithTitle:@"Section Header" detailTitle:[LLFormatterTool formatNumber:@(self.sectionHeaderHeight)]] noneInsets]; model19.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(self.sectionHeaderHeight)] handler:^(NSString * _Nullable newText) { - weakSelf.sectionHeaderHeight = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"sectionHeaderHeight"]; }; [settings addObject:model19]; LLTitleCellModel *model20 = [[LLTitleCellModel alloc] initWithTitle:@"Section Footer" detailTitle:[LLFormatterTool formatNumber:@(self.sectionFooterHeight)]]; model20.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.sectionFooterHeight)] handler:^(NSString * _Nullable newText) { - weakSelf.sectionFooterHeight = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"sectionFooterHeight"]; }; [settings addObject:model20]; @@ -1752,17 +1753,13 @@ @implementation UITableViewCell (LL_Hierarchy) LLTitleCellModel *model6 = [[[LLTitleCellModel alloc] initWithTitle:@"Indentation" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.indentationLevel]] noneInsets]; model6.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.indentationLevel] handler:^(NSString * _Nullable newText) { - weakSelf.indentationLevel = [newText integerValue]; - }]; + [weakSelf LL_showIntAlertAndAutomicSetWithKeyPath:@"indentationLevel"]; }; [settings addObject:model6]; LLTitleCellModel *model7 = [[[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[LLFormatterTool formatNumber:@(self.indentationWidth)]] noneInsets]; model7.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.indentationWidth)] handler:^(NSString * _Nullable newText) { - weakSelf.indentationWidth = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"indentationWidth"]; }; [settings addObject:model7]; @@ -1782,9 +1779,7 @@ @implementation UITableViewCell (LL_Hierarchy) LLTitleCellModel *model10 = [[[LLTitleCellModel alloc] initWithTitle:@"Separator Inset" detailTitle:[self LL_hierarchyInsetsTopBottomDescription:self.separatorInset]] noneInsets]; model10.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:NSStringFromUIEdgeInsets(weakSelf.separatorInset) handler:^(NSString * _Nullable newText) { - weakSelf.separatorInset = [weakSelf LL_insetsFromString:newText originalInsets:weakSelf.separatorInset]; - }]; + [weakSelf LL_showEdgeInsetsAndAutomicSetWithKeyPath:@"separatorInset"]; }; [settings addObject:model10]; @@ -1864,17 +1859,13 @@ @implementation UITextView (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Plain Text" detailTitle:[self LL_hierarchyTextDescription:self.text]] noneInsets]; model1.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:weakSelf.text handler:^(NSString * _Nullable newText) { - weakSelf.text = newText; - }]; + [weakSelf LL_showTextAlertAndAutomicSetWithKeyPath:@"text"]; }; [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Attributed Text" detailTitle:[self LL_hierarchyObjectDescription:self.attributedText]] noneInsets]; model2.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:weakSelf.attributedText.string handler:^(NSString * _Nullable newText) { - [weakSelf LL_replaceAttributeString:newText key:@"attributedText"]; - }]; + [weakSelf LL_showAttributeTextAlertAndAutomicSetWithKeyPath:@"attributedText"]; }; [settings addObject:model2]; @@ -1887,15 +1878,13 @@ @implementation UITextView (LL_Hierarchy) LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Color" detailTitle:[self LL_hierarchyColorDescription:self.textColor]] noneInsets]; model4.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"textColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"textColor"]; }; [settings addObject:model4]; LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Font" detailTitle:[self LL_hierarchyObjectDescription:self.font]] noneInsets]; model5.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%@",[LLFormatterTool formatNumber:@(weakSelf.font.pointSize)]] handler:^(NSString * _Nullable newText) { - weakSelf.font = [weakSelf.font fontWithSize:[newText doubleValue]]; - }]; + [weakSelf LL_showFontAlertAndAutomicSetWithKeyPath:@"font"]; }; [settings addObject:model5]; @@ -2081,42 +2070,25 @@ @implementation UIDatePicker (LL_Hierarchy) LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Interval" detailTitle:[NSString stringWithFormat:@"%ld",(long)self.minuteInterval]]; model3.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[NSString stringWithFormat:@"%ld",(long)weakSelf.minuteInterval] handler:^(NSString * _Nullable newText) { - weakSelf.minuteInterval = [newText integerValue]; - }]; + [weakSelf LL_showIntAlertAndAutomicSetWithKeyPath:@"minuteInterval"]; }; [settings addObject:model3]; LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Date" detailTitle:[self LL_hierarchyDateDescription:self.date]] noneInsets]; model4.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool stringFromDate:weakSelf.date style:FormatterToolDateStyle3] handler:^(NSString * _Nullable newText) { - NSDate *newDate = [LLFormatterTool dateFromString:newText style:FormatterToolDateStyle3]; - if (newDate) { - weakSelf.date = newDate; - } - }]; + [weakSelf LL_showDateAlertAndAutomicSetWithKeyPath:@"date"]; }; [settings addObject:model4]; LLTitleCellModel *model5 = [[[LLTitleCellModel alloc] initWithTitle:@"Min Date" detailTitle:[self LL_hierarchyDateDescription:self.minimumDate]] noneInsets]; model5.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool stringFromDate:weakSelf.minimumDate style:FormatterToolDateStyle3] handler:^(NSString * _Nullable newText) { - NSDate *newDate = [LLFormatterTool dateFromString:newText style:FormatterToolDateStyle3]; - if (newDate) { - weakSelf.minimumDate = newDate; - } - }]; + [weakSelf LL_showDateAlertAndAutomicSetWithKeyPath:@"minimumDate"]; }; [settings addObject:model5]; LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Max Date" detailTitle:[self LL_hierarchyDateDescription:self.maximumDate]]; model6.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool stringFromDate:weakSelf.maximumDate style:FormatterToolDateStyle3] handler:^(NSString * _Nullable newText) { - NSDate *newDate = [LLFormatterTool dateFromString:newText style:FormatterToolDateStyle3]; - if (newDate) { - weakSelf.maximumDate = newDate; - } - }]; + [weakSelf LL_showDateAlertAndAutomicSetWithKeyPath:@"maximumDate"]; }; [settings addObject:model6]; @@ -2190,7 +2162,7 @@ @implementation UINavigationBar (LL_Hierarchy) LLTitleCellModel *model4 = [[[LLTitleCellModel alloc] initWithTitle:@"Bar Tint" detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]] noneInsets]; model4.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"barTintColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"barTintColor"]; }; [settings addObject:model4]; @@ -2308,7 +2280,7 @@ @implementation UIToolbar (LL_Hierarchy) LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Bar Tint" detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; model3.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"barTintColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"barTintColor"]; }; [settings addObject:model3]; @@ -2357,7 +2329,7 @@ @implementation UITabBar (LL_Hierarchy) LLTitleCellModel *model6 = [[LLTitleCellModel alloc] initWithTitle:@"Bar Tint" detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; model6.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"barTintColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"barTintColor"]; }; [settings addObject:model6]; @@ -2371,17 +2343,13 @@ @implementation UITabBar (LL_Hierarchy) LLTitleCellModel *model8 = [[[LLTitleCellModel alloc] initWithTitle:@"Item Width" detailTitle:[LLFormatterTool formatNumber:@(self.itemWidth)]] noneInsets]; model8.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.itemWidth)] handler:^(NSString * _Nullable newText) { - weakSelf.itemWidth = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"itemWidth"]; }; [settings addObject:model8]; LLTitleCellModel *model9 = [[LLTitleCellModel alloc] initWithTitle:@"Item Spacing" detailTitle:[LLFormatterTool formatNumber:@(self.itemSpacing)]]; model9.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(weakSelf.itemSpacing)] handler:^(NSString * _Nullable newText) { - weakSelf.itemSpacing = [newText doubleValue]; - }]; + [weakSelf LL_showDoubleAlertAndAutomicSetWithKeyPath:@"itemSpacing"]; }; [settings addObject:model9]; @@ -2406,25 +2374,19 @@ @implementation UISearchBar (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Text" detailTitle:[self LL_hierarchyTextDescription:self.text]] noneInsets]; model1.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:weakSelf.text handler:^(NSString * _Nullable newText) { - weakSelf.text = newText; - }]; + [weakSelf LL_showTextAlertAndAutomicSetWithKeyPath:@"text"]; }; [settings addObject:model1]; LLTitleCellModel *model2 = [[[LLTitleCellModel alloc] initWithTitle:@"Placeholder" detailTitle:[self LL_hierarchyTextDescription:self.placeholder]] noneInsets]; model2.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:weakSelf.placeholder handler:^(NSString * _Nullable newText) { - weakSelf.placeholder = newText; - }]; + [weakSelf LL_showTextAlertAndAutomicSetWithKeyPath:@"placeholder"]; }; [settings addObject:model2]; LLTitleCellModel *model3 = [[LLTitleCellModel alloc] initWithTitle:@"Prompt" detailTitle:[self LL_hierarchyTextDescription:self.prompt]]; model3.block = ^{ - [weakSelf LL_showTextFieldAlertWithText:weakSelf.prompt handler:^(NSString * _Nullable newText) { - weakSelf.prompt = newText; - }]; + [weakSelf LL_showTextAlertAndAutomicSetWithKeyPath:@"prompt"]; }; [settings addObject:model3]; @@ -2453,7 +2415,7 @@ @implementation UISearchBar (LL_Hierarchy) LLTitleCellModel *model7 = [[LLTitleCellModel alloc] initWithTitle:nil detailTitle:[self LL_hierarchyColorDescription:self.barTintColor]]; model7.block = ^{ - [weakSelf LL_showColorAlertAndAutomicSetWithKey:@"barTintColor"]; + [weakSelf LL_showColorAlertAndAutomicSetWithKeyPath:@"barTintColor"]; }; [settings addObject:model7]; From ad844d4f52486eed5718d96296d8240b557834c9 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Thu, 31 Oct 2019 14:32:10 +0800 Subject: [PATCH 40/45] Update demo. --- LLDebugToolDemo/ViewController.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LLDebugToolDemo/ViewController.m b/LLDebugToolDemo/ViewController.m index 80deece4..33c8840d 100644 --- a/LLDebugToolDemo/ViewController.m +++ b/LLDebugToolDemo/ViewController.m @@ -39,6 +39,8 @@ @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; + self.imgView.tag = 101; + // Try to get album permission, and if possible, screenshots are stored in the album at the same time. [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) { From 2cae3c5911d525c35f3c995f3208a4f2216b2f05 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Thu, 31 Oct 2019 14:32:34 +0800 Subject: [PATCH 41/45] Add quick dynamic entry. --- .../LLFunctionItemContainerView.m | 2 +- .../Function/NSObject+LL_Hierarchy.h | 8 + .../Function/NSObject+LL_Hierarchy.m | 2 + .../UserInterface/LLHierarchyInfoView.m | 142 +++++++++++++++--- .../Others/Category/UIView/UIView+LL_Utils.h | 2 +- .../Others/Category/UIView/UIView+LL_Utils.m | 2 +- 6 files changed, 138 insertions(+), 20 deletions(-) diff --git a/LLDebugTool/Core/Component/Function/UserInterface/LLFunctionItemContainerView.m b/LLDebugTool/Core/Component/Function/UserInterface/LLFunctionItemContainerView.m index 825b2136..a53081c9 100644 --- a/LLDebugTool/Core/Component/Function/UserInterface/LLFunctionItemContainerView.m +++ b/LLDebugTool/Core/Component/Function/UserInterface/LLFunctionItemContainerView.m @@ -90,7 +90,7 @@ - (void)updateUI:(NSArray *)dataArray { for (int i = 0; i < dataArray.count; i++) { LLFunctionItemModel *model = dataArray[i]; LLFunctionItemView *itemView = [[LLFunctionItemView alloc] initWithFrame:CGRectZero]; - [itemView LL_AddClickListener:self action:@selector(itemViewClicked:)]; + [itemView LL_addClickListener:self action:@selector(itemViewClicked:)]; itemView.model = model; [self addSubview:itemView]; [self.itemViews addObject:itemView]; diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.h b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.h index 0a101446..383b1457 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.h +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.h @@ -33,6 +33,14 @@ NS_ASSUME_NONNULL_BEGIN - (NSArray *)LL_hierarchyCategoryModels; +- (void)LL_showIntAlertAndAutomicSetWithKeyPath:(NSString *)keyPath; + +- (void)LL_showFrameAlertAndAutomicSetWithKeyPath:(NSString *)keyPath; + +- (void)LL_showColorAlertAndAutomicSetWithKeyPath:(NSString *)keyPath; + +- (void)LL_showFontAlertAndAutomicSetWithKeyPath:(NSString *)keyPath; + @end @interface UIView (LL_Hierarchy) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index 5dc4cc2b..a631c377 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -482,6 +482,7 @@ @implementation UIView (LL_Hierarchy) mod.block = ^{ [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(cons.constant)] handler:^(NSString * _Nullable newText) { cons.constant = [newText doubleValue]; + [weakSelf setNeedsLayout]; }]; }; [settings addObject:mod]; @@ -501,6 +502,7 @@ @implementation UIView (LL_Hierarchy) mod.block = ^{ [weakSelf LL_showTextFieldAlertWithText:[LLFormatterTool formatNumber:@(cons.constant)] handler:^(NSString * _Nullable newText) { cons.constant = [newText doubleValue]; + [weakSelf setNeedsLayout]; }]; }; [settings addObject:mod]; diff --git a/LLDebugTool/Core/Component/Hierarchy/UserInterface/LLHierarchyInfoView.m b/LLDebugTool/Core/Component/Hierarchy/UserInterface/LLHierarchyInfoView.m index 9837ed0b..d7e8bf46 100644 --- a/LLDebugTool/Core/Component/Hierarchy/UserInterface/LLHierarchyInfoView.m +++ b/LLDebugTool/Core/Component/Hierarchy/UserInterface/LLHierarchyInfoView.m @@ -33,6 +33,7 @@ #import "LLToastUtils.h" #import "LLImageNameConfig.h" #import "UIView+LL_Utils.h" +#import "NSObject+LL_Hierarchy.h" @interface LLHierarchyInfoView () @@ -40,6 +41,16 @@ @interface LLHierarchyInfoView () @property (nonatomic, strong) UILabel *contentLabel; +@property (nonatomic, strong) UILabel *frameLabel; + +@property (nonatomic, strong) UILabel *backgroundColorLabel; + +@property (nonatomic, strong) UILabel *textColorLabel; + +@property (nonatomic, strong) UILabel *fontLabel; + +@property (nonatomic, strong) UILabel *tagLabel; + @property (nonatomic, strong) UIView *actionContentView; @property (nonatomic, strong) UIButton *moreButton; @@ -77,41 +88,52 @@ - (void)updateSelectedView:(UIView *)selectedView { NSDictionary *boldAttri = @{NSFontAttributeName: [UIFont boldSystemFontOfSize:17]}; NSDictionary *attri = @{NSFontAttributeName: [UIFont systemFontOfSize:14]}; - NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] init]; - NSMutableAttributedString *name = [[NSMutableAttributedString alloc] initWithString:@"Name: " attributes:boldAttri]; [name appendAttributedString:[[NSAttributedString alloc] initWithString:NSStringFromClass(view.class) attributes:attri]]; - [attribute appendAttributedString:name]; + self.contentLabel.attributedText = name; - NSMutableAttributedString *frame = [[NSMutableAttributedString alloc] initWithString:@"\nFrame: " attributes:boldAttri]; + NSMutableAttributedString *frame = [[NSMutableAttributedString alloc] initWithString:@"Frame: " attributes:boldAttri]; [frame appendAttributedString:[[NSAttributedString alloc] initWithString:[LLTool stringFromFrame:view.frame] attributes:attri]]; - [attribute appendAttributedString:frame]; + + self.frameLabel.attributedText = frame; if (view.backgroundColor) { - NSMutableAttributedString *color = [[NSMutableAttributedString alloc] initWithString:@"\nBackground: " attributes:boldAttri]; + NSMutableAttributedString *color = [[NSMutableAttributedString alloc] initWithString:@"Background: " attributes:boldAttri]; [color appendAttributedString:[[NSAttributedString alloc] initWithString:[view.backgroundColor LL_description] attributes:attri]]; - [attribute appendAttributedString:color]; + self.backgroundColorLabel.attributedText = color; + } else { + self.backgroundColorLabel.attributedText = nil; } if ([view isKindOfClass:[UILabel class]]) { UILabel *label = (UILabel *)view; - NSMutableAttributedString *font = [[NSMutableAttributedString alloc] initWithString:@"\nText Color: " attributes:boldAttri]; - [font appendAttributedString:[[NSAttributedString alloc] initWithString:[label.textColor LL_description] attributes:attri]]; - [font appendAttributedString:[[NSAttributedString alloc] initWithString:@"\nFont: " attributes:boldAttri]]; + NSMutableAttributedString *textColor = [[NSMutableAttributedString alloc] initWithString:@"Text Color: " attributes:boldAttri]; + [textColor appendAttributedString:[[NSAttributedString alloc] initWithString:[label.textColor LL_description] attributes:attri]]; + self.textColorLabel.attributedText = textColor; + + NSMutableAttributedString *font = [[NSMutableAttributedString alloc] initWithString:@"Font: " attributes:boldAttri]; [font appendAttributedString:[[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%0.2f", label.font.pointSize] attributes:attri]]; - [attribute appendAttributedString:font]; + self.fontLabel.attributedText = font; + } else { + self.textColorLabel.attributedText = nil; + self.fontLabel.attributedText = nil; } if (view.tag != 0) { - NSMutableAttributedString *tag = [[NSMutableAttributedString alloc] initWithString:@"\nTag: " attributes:boldAttri]; + NSMutableAttributedString *tag = [[NSMutableAttributedString alloc] initWithString:@"Tag: " attributes:boldAttri]; [tag appendAttributedString:[[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%ld",(long)view.tag] attributes:attri]]; - [attribute appendAttributedString:tag]; + self.tagLabel.attributedText = tag; + } else { + self.tagLabel.attributedText = nil; } - self.contentLabel.attributedText = attribute; - [self.contentLabel sizeToFit]; + [self.frameLabel sizeToFit]; + [self.backgroundColorLabel sizeToFit]; + [self.textColorLabel sizeToFit]; + [self.fontLabel sizeToFit]; + [self.tagLabel sizeToFit]; [self updateHeightIfNeeded]; } @@ -127,7 +149,17 @@ - (void)layoutSubviews { self.moreButton.frame = CGRectMake(kLLGeneralMargin, self.parentViewsButton.LL_bottom + kLLGeneralMargin, self.actionContentView.LL_width - kLLGeneralMargin * 2, self.parentViewsButton.LL_height); - self.contentLabel.frame = CGRectMake(kLLGeneralMargin, kLLGeneralMargin, self.closeButton.LL_x - kLLGeneralMargin - kLLGeneralMargin, self.actionContentView.LL_y - kLLGeneralMargin - kLLGeneralMargin); + self.contentLabel.frame = CGRectMake(kLLGeneralMargin, kLLGeneralMargin, self.closeButton.LL_x - kLLGeneralMargin - kLLGeneralMargin, self.contentLabel.LL_height); + + self.frameLabel.frame = CGRectMake(self.contentLabel.LL_x, self.contentLabel.LL_bottom, self.contentLabel.LL_width, self.frameLabel.LL_height); + + self.backgroundColorLabel.frame = CGRectMake(self.contentLabel.LL_x, self.frameLabel.LL_bottom, self.contentLabel.LL_width, self.backgroundColorLabel.LL_height); + + self.textColorLabel.frame = CGRectMake(self.contentLabel.LL_x, self.backgroundColorLabel.LL_bottom, self.contentLabel.LL_width, self.textColorLabel.LL_height); + + self.fontLabel.frame = CGRectMake(self.contentLabel.LL_x, self.textColorLabel.LL_bottom, self.contentLabel.LL_width, self.fontLabel.LL_height); + + self.tagLabel.frame = CGRectMake(self.contentLabel.LL_x, self.fontLabel.LL_bottom, self.contentLabel.LL_width, self.tagLabel.LL_height); } #pragma mark - Over write @@ -136,6 +168,11 @@ - (void)initUI { self.actionContentViewHeight = 80; [self addSubview:self.contentLabel]; + [self addSubview:self.frameLabel]; + [self addSubview:self.backgroundColorLabel]; + [self addSubview:self.textColorLabel]; + [self addSubview:self.fontLabel]; + [self addSubview:self.tagLabel]; [self addSubview:self.actionContentView]; [self.actionContentView addSubview:self.parentViewsButton]; [self.actionContentView addSubview:self.subviewsButton]; @@ -149,9 +186,30 @@ - (void)buttonClicked:(UIButton *)sender { [self.delegate LLHierarchyInfoView:self didSelectAt:sender.tag]; } +- (void)frameLabelTapGestureRecognizer:(UITapGestureRecognizer *)sender { + [self.selectedView LL_showFrameAlertAndAutomicSetWithKeyPath:@"frame"]; +} + +- (void)backgroundColorLabelTapGestureRecognizer:(UITapGestureRecognizer *)sender { + [self.selectedView LL_showColorAlertAndAutomicSetWithKeyPath:@"backgroundColor"]; +} + +- (void)textColorLabelTapGestureRecognizer:(UITapGestureRecognizer *)sender { + [self.selectedView LL_showColorAlertAndAutomicSetWithKeyPath:@"textColor"]; +} + +- (void)fontLabelTapGestureRecognizer:(UITapGestureRecognizer *)sender { + [self.selectedView LL_showFontAlertAndAutomicSetWithKeyPath:@"font"]; +} + +- (void)tagLabelTapGestureRecognizer:(UITapGestureRecognizer *)sender { + [self.selectedView LL_showIntAlertAndAutomicSetWithKeyPath:@"tag"]; +} + #pragma mark - Primary - (void)updateHeightIfNeeded { - CGFloat height = kLLGeneralMargin + MAX(self.contentLabel.LL_height, self.closeButton.LL_height) + kLLGeneralMargin + self.actionContentViewHeight + kLLGeneralMargin; + CGFloat contentHeight = self.contentLabel.LL_height + self.frameLabel.LL_height + self.backgroundColorLabel.LL_height + self.textColorLabel.LL_height + self.fontLabel.LL_height + self.tagLabel.LL_height; + CGFloat height = kLLGeneralMargin + MAX(contentHeight, self.closeButton.LL_height) + kLLGeneralMargin + self.actionContentViewHeight + kLLGeneralMargin; if (height != self.LL_height) { self.LL_height = height; if (!self.isMoved) { @@ -180,6 +238,56 @@ - (UILabel *)contentLabel { return _contentLabel; } +- (UILabel *)frameLabel { + if (!_frameLabel) { + _frameLabel = [LLFactory getLabel:nil frame:CGRectZero text:nil font:14 textColor:[LLThemeManager shared].primaryColor]; + _frameLabel.numberOfLines = 0; + _frameLabel.lineBreakMode = NSLineBreakByCharWrapping; + [_frameLabel LL_addClickListener:self action:@selector(frameLabelTapGestureRecognizer:)]; + } + return _frameLabel; +} + +- (UILabel *)backgroundColorLabel { + if (!_backgroundColorLabel) { + _backgroundColorLabel = [LLFactory getLabel:nil frame:CGRectZero text:nil font:14 textColor:[LLThemeManager shared].primaryColor]; + _backgroundColorLabel.numberOfLines = 0; + _backgroundColorLabel.lineBreakMode = NSLineBreakByCharWrapping; + [_backgroundColorLabel LL_addClickListener:self action:@selector(backgroundColorLabelTapGestureRecognizer:)]; + } + return _backgroundColorLabel; +} + +- (UILabel *)textColorLabel { + if (!_textColorLabel) { + _textColorLabel = [LLFactory getLabel:nil frame:CGRectZero text:nil font:14 textColor:[LLThemeManager shared].primaryColor]; + _textColorLabel.numberOfLines = 0; + _textColorLabel.lineBreakMode = NSLineBreakByCharWrapping; + [_textColorLabel LL_addClickListener:self action:@selector(textColorLabelTapGestureRecognizer:)]; + } + return _textColorLabel; +} + +- (UILabel *)fontLabel { + if (!_fontLabel) { + _fontLabel = [LLFactory getLabel:nil frame:CGRectZero text:nil font:14 textColor:[LLThemeManager shared].primaryColor]; + _fontLabel.numberOfLines = 0; + _fontLabel.lineBreakMode = NSLineBreakByCharWrapping; + [_fontLabel LL_addClickListener:self action:@selector(fontLabelTapGestureRecognizer:)]; + } + return _fontLabel; +} + +- (UILabel *)tagLabel { + if (!_tagLabel) { + _tagLabel = [LLFactory getLabel:nil frame:CGRectZero text:nil font:14 textColor:[LLThemeManager shared].primaryColor]; + _tagLabel.numberOfLines = 0; + _tagLabel.lineBreakMode = NSLineBreakByCharWrapping; + [_tagLabel LL_addClickListener:self action:@selector(tagLabelTapGestureRecognizer:)]; + } + return _tagLabel; +} + - (UIView *)actionContentView { if (!_actionContentView) { _actionContentView = [LLFactory getView]; diff --git a/LLDebugTool/Core/Others/Category/UIView/UIView+LL_Utils.h b/LLDebugTool/Core/Others/Category/UIView/UIView+LL_Utils.h index 7e5b2b39..85dc801f 100644 --- a/LLDebugTool/Core/Others/Category/UIView/UIView+LL_Utils.h +++ b/LLDebugTool/Core/Others/Category/UIView/UIView+LL_Utils.h @@ -63,7 +63,7 @@ NS_ASSUME_NONNULL_BEGIN - (UIView *_Nullable)LL_bottomView; -- (void)LL_AddClickListener:(id)target action:(SEL)action; +- (void)LL_addClickListener:(id)target action:(SEL)action; - (UIImage *)LL_convertViewToImage; diff --git a/LLDebugTool/Core/Others/Category/UIView/UIView+LL_Utils.m b/LLDebugTool/Core/Others/Category/UIView/UIView+LL_Utils.m index cc19a8e5..78c8bfd7 100644 --- a/LLDebugTool/Core/Others/Category/UIView/UIView+LL_Utils.m +++ b/LLDebugTool/Core/Others/Category/UIView/UIView+LL_Utils.m @@ -191,7 +191,7 @@ - (UIView *_Nullable)LL_bottomView { return view; } -- (void)LL_AddClickListener:(id)target action:(SEL)action { +- (void)LL_addClickListener:(id)target action:(SEL)action { UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:target action:action]; [self addGestureRecognizer:tap]; self.userInteractionEnabled = YES; From 152ba7a096dbec26b354335721ffb9e79c749a10 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Thu, 31 Oct 2019 14:47:06 +0800 Subject: [PATCH 42/45] Change default double click action. --- LLDebugTool/DebugTool/LLConfig.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LLDebugTool/DebugTool/LLConfig.m b/LLDebugTool/DebugTool/LLConfig.m index 5e15bddd..5a4913e7 100644 --- a/LLDebugTool/DebugTool/LLConfig.m +++ b/LLDebugTool/DebugTool/LLConfig.m @@ -181,7 +181,7 @@ - (void)initial { // Click action _clickAction = LLDebugToolActionFunction; - _doubleClickAction = LLDebugToolActionConvenientScreenshot; + _doubleClickAction = LLDebugToolActionHierarchy; // Set default window's style. _entryWindowStyle = LLConfigEntryWindowStyleBall; From cf11731d19ddddc74636e4ff41efaf1bf8c51cf2 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Thu, 31 Oct 2019 15:01:36 +0800 Subject: [PATCH 43/45] Update for 1.3.4 --- CHANGELOG.md | 10 ++++++++++ README-cn.md | 30 ++++++++++++++++-------------- README.md | 30 ++++++++++++++++-------------- 3 files changed, 42 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0d1bc3e..f4dfbece 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## [1.3.4](https://github.com/HDB-Li/LLDebugTool/releases/tag/1.3.4) (10/31/2019) + +### More practical `Hierarchy` function + +Now you can use the `Hierarchy` function to dynamically modify attribute values. There are common attributes in the shortcut interface and most attributes in the details interface. It's a very interesting and useful function. + +#### Update + +* Update `Hierarchy Detail` to dynamic modify properties. + ## [1.3.3](https://github.com/HDB-Li/LLDebugTool/releases/tag/1.3.3) (10/18/2019) ### Add `Html` function. diff --git a/README-cn.md b/README-cn.md index e0a3226f..49c24031 100644 --- a/README-cn.md +++ b/README-cn.md @@ -3,7 +3,7 @@

[![Version](https://img.shields.io/badge/iOS-%3E%3D8.0-f07e48.svg)](https://img.shields.io/badge/iOS-%3E%3D8.0-f07e48.svg) -[![CocoaPods Compatible](https://img.shields.io/badge/Pod-v1.3.3-blue.svg)](https://img.shields.io/badge/Pod-v1.3.3-blue.svg) +[![CocoaPods Compatible](https://img.shields.io/badge/Pod-v1.3.4-blue.svg)](https://img.shields.io/badge/Pod-v1.3.4-blue.svg) [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Platform](https://img.shields.io/badge/Platform-iOS-lightgrey.svg)](https://img.shields.io/badge/Platform-iOS-lightgrey.svg) [![License](https://img.shields.io/badge/License-Anti%20996-blue.svg)](https://github.com/996icu/996.ICU/blob/master/LICENSE) @@ -45,15 +45,15 @@ LLDebugTool是一款针对开发者和测试者的调试工具,它可以帮助 -## 最近更新 (1.3.3) +## 最近更新 (1.3.4) -### 新增 `Html` 功能。 +### 更实用的 `Hierarchy` 功能 -你可以在你的app中随时调试通过 `WKWebView`,`UIWebView` 或者你自定义的`ViewController`来调试html页面。 +现在你可以用 `Hierarchy` 功能动态的修改属性值。在快捷界面里有常用的属性,在详情界面里有大部分的属性。 -#### 新增 +#### 更新 -* 现在 `LLURLProtocol` 可以正确的监听 `WKWebView`。 +* 更新 `Hierarchy Detail` 实现动态修改属性值的功能。 ## 我能用LLDebugTool做什么? @@ -71,7 +71,7 @@ LLDebugTool是一款针对开发者和测试者的调试工具,它可以帮助 - 截屏、标注并分享。 -- 更直观的查看视图结构。 +- 更直观的查看视图结构,并修改具体属性值。 - 更准确地确定App里的UI元素和颜色。 @@ -79,6 +79,8 @@ LLDebugTool是一款针对开发者和测试者的调试工具,它可以帮助 - 便捷的查看元素边框及位置。 +- 快速的Html容器入口。 + ## 添加 LLDebugTool 到你的项目中 ### CocoaPods @@ -87,17 +89,17 @@ LLDebugTool是一款针对开发者和测试者的调试工具,它可以帮助 ##### Objective - C -> 1. 添加 `pod 'LLDebugTool' , '~> 1.0.0'` 到你的Podfile里。 -> 2. 如果只想在Debug模式下使用,则添加`pod 'LLDebugTool' , '~> 1.0.0' ,:configurations => ['Debug']` 到你的Podfile里,详细的配置方式可以查看[Wiki/如何仅在Debug环境中使用](https://github.com/HDB-Li/LLDebugTool/wiki/如何仅在Debug环境中使用)。如果你想要指定某个版本,可以类似这样使用 `pod 'LLDebugTool' , '1.3.3' ,:configurations => ['Debug']`。 -> 3. 推荐的方式是采用多Target来处理,只在Debug Target中添加`pod 'LLDebugTool' , '~> 1.0.0'`,这样做的好处既不污染Product环境的代码,又可以在Archive Debug环境的App时,将`LLDebugTool`集成进去(如果采用`:configurations => ['Debug']`的方式,只能通过XCode运行,不可以Archive成App)。 +> 1. 添加 `pod 'LLDebugTool' , '~> 1.0'` 到你的Podfile里。 +> 2. 如果只想在Debug模式下使用,则添加`pod 'LLDebugTool' , '~> 1.0' ,:configurations => ['Debug']` 到你的Podfile里,详细的配置方式可以查看[Wiki/如何仅在Debug环境中使用](https://github.com/HDB-Li/LLDebugTool/wiki/如何仅在Debug环境中使用)。如果你想要指定某个版本,可以类似这样使用 `pod 'LLDebugTool' , '1.3.4' ,:configurations => ['Debug']`。 +> 3. 推荐的方式是采用多Target来处理,只在Debug Target中添加`pod 'LLDebugTool' , '~> 1.0'`,这样做的好处既不污染Product环境的代码,又可以在Archive Debug环境的App时,将`LLDebugTool`集成进去(如果采用`:configurations => ['Debug']`的方式,只能通过XCode运行,不可以Archive成App)。 > 4. 终端输入`pod install`来进行集成。搜索不到`LLDebugTool`或者搜不到最新版本时,可先运行`pod repo update`,再执行`pod install`。 > 5. 在你需要使用LLDebugTool的文件里添加`#import "LLDebug.h"`,或者直接在pch文件中添加`#import "LLDebug.h"`。 ##### Swift -> 1. 添加 `pod 'LLDebugToolSwift' , '~> 1.0.0'` 到你的Podfile里。 -> 2. 如果只想在Debug模式下使用,则添加`pod 'LLDebugToolSwift' , '~> 1.0.0' ,:configurations => ['Debug']` 到你的Podfile里,详细的配置方式可以查看[Wiki/如何仅在Debug环境中使用](https://github.com/HDB-Li/LLDebugTool/wiki/如何仅在Debug环境中使用)。如果你想要指定某个版本,可以类似这样使用 `pod 'LLDebugToolSwift' , '1.3.3' ,:configurations => ['Debug']`。 -> 3. 推荐的方式是采用多Target来处理,只在Debug Target中添加`pod 'LLDebugToolSwift' , '~> 1.0.0'`,这样做的好处既不污染Product环境的代码,又可以在Archive Debug环境的App时,将`LLDebugToolSwift`集成进去(如果采用`:configurations => ['Debug']`的方式,只能通过XCode运行,不可以Archive成App)。 +> 1. 添加 `pod 'LLDebugToolSwift' , '~> 1.0'` 到你的Podfile里。 +> 2. 如果只想在Debug模式下使用,则添加`pod 'LLDebugToolSwift' , '~> 1.0' ,:configurations => ['Debug']` 到你的Podfile里,详细的配置方式可以查看[Wiki/如何仅在Debug环境中使用](https://github.com/HDB-Li/LLDebugTool/wiki/如何仅在Debug环境中使用)。如果你想要指定某个版本,可以类似这样使用 `pod 'LLDebugToolSwift' , '1.3.4' ,:configurations => ['Debug']`。 +> 3. 推荐的方式是采用多Target来处理,只在Debug Target中添加`pod 'LLDebugToolSwift' , '~> 1.0'`,这样做的好处既不污染Product环境的代码,又可以在Archive Debug环境的App时,将`LLDebugToolSwift`集成进去(如果采用`:configurations => ['Debug']`的方式,只能通过XCode运行,不可以Archive成App)。 > 4. 必须在Podfile中添加 **`use_frameworks!`** 。 > 5. 终端输入`pod install`来进行集成。搜索不到`LLDebugToolSwift`或者搜不到最新版本时,可先运行`pod repo update`,再执行`pod install`。 > 6. 在你需要使用LLDebugTool的文件里添加`import LLDebugToolSwift`。 @@ -324,7 +326,7 @@ LLDebugTool提供了一个截屏功能,并且可以进行简单的绘画和标 ### 视图结构 -LLDebugTool提供了一个视图结构工具,用于在非Debug模式下查看元素的属性和信息。 +LLDebugTool提供了一个视图结构工具,用于在非Debug模式下查看或者修改元素的属性和信息。 ### 放大镜 diff --git a/README.md b/README.md index 11b005e1..e4e25b78 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

[![Version](https://img.shields.io/badge/iOS-%3E%3D8.0-f07e48.svg)](https://img.shields.io/badge/iOS-%3E%3D8.0-f07e48.svg) -[![CocoaPods Compatible](https://img.shields.io/badge/pod-v1.3.3-blue.svg)](https://img.shields.io/badge/pod-v1.3.3-blue.svg) +[![CocoaPods Compatible](https://img.shields.io/badge/pod-v1.3.4-blue.svg)](https://img.shields.io/badge/pod-v1.3.4-blue.svg) [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) [![Platform](https://img.shields.io/badge/Platform-iOS-lightgrey.svg)](https://img.shields.io/badge/Platform-iOS-lightgrey.svg) [![License](https://img.shields.io/badge/License-Anti%20996-blue.svg)](https://github.com/996icu/996.ICU/blob/master/LICENSE) @@ -45,15 +45,15 @@ Choose LLDebugTool for your next project, or migrate over your existing projects -## What's new in 1.3.3 +## What's new in 1.3.4 -### Add `Html` function. +### More practical `Hierarchy` function -You can debug HTML pages through `WKWebView`, `UIWebView` or your customized `ViewController` in your app at any time. +Now you can use the `Hierarchy` function to dynamically modify attribute values. There are common attributes in the shortcut interface and most attributes in the details interface. It's a very interesting and useful function. -#### Add +#### Update -* Now `LLURLProtocol` can correctly observe `WKWebView`. +* Update `Hierarchy Detail` to dynamic modify properties. ## What can you do with LLDebugTool? @@ -71,7 +71,7 @@ You can debug HTML pages through `WKWebView`, `UIWebView` or your customized `Vi - take screenshots, tag and share. -- more intuitive view of view structure. +- more intuitive view of view structure and dynamic modify properties. - determine UI elements and colors in your App more accurately. @@ -79,6 +79,8 @@ You can debug HTML pages through `WKWebView`, `UIWebView` or your customized `Vi - easy access to element borders and frames. +- quick entry for html. + ## Adding LLDebugTool to your project ### CocoaPods @@ -87,17 +89,17 @@ You can debug HTML pages through `WKWebView`, `UIWebView` or your customized `Vi ##### Objective - C -> 1. Add a pod entry for LLDebugTool to your Podfile `pod 'LLDebugTool' , '~> 1.0.0'`. -> 2. If only you want to use it only in Debug mode, Add a pod entry for LLDebugTool to your Podfile `pod 'LLDebugTool' , '~> 1.0.0' ,:configurations => ['Debug']`, Details also see [Wiki/Use in Debug environment](https://github.com/HDB-Li/LLDebugTool/wiki/Use-in-Debug-environment). If you want to specify the version, use as `pod 'LLDebugTool' , '1.3.3' ,:configurations => ['Debug']`. -> 3. The recommended approach is to use multiple targets and only add `pod 'LLDebugTool', '~> 1.0.0'` to Debug Target. This has the advantage of not contamiling the code in the Product environment and can be integrated into the App in the Archive Debug environment (if `:configurations => ['Debug']`, it can only run through XCode. It is not possible to Archive as an App). +> 1. Add a pod entry for LLDebugTool to your Podfile `pod 'LLDebugTool' , '~> 1.0'`. +> 2. If only you want to use it only in Debug mode, Add a pod entry for LLDebugTool to your Podfile `pod 'LLDebugTool' , '~> 1.0' ,:configurations => ['Debug']`, Details also see [Wiki/Use in Debug environment](https://github.com/HDB-Li/LLDebugTool/wiki/Use-in-Debug-environment). If you want to specify the version, use as `pod 'LLDebugTool' , '1.3.4' ,:configurations => ['Debug']`. +> 3. The recommended approach is to use multiple targets and only add `pod 'LLDebugTool', '~> 1.0'` to Debug Target. This has the advantage of not contamiling the code in the Product environment and can be integrated into the App in the Archive Debug environment (if `:configurations => ['Debug']`, it can only run through XCode. It is not possible to Archive as an App). > 4. Install the pod(s) by running `pod install`. If you can't search `LLDebugTool` or you can't find the newest release version, running `pod repo update` before `pod install`. > 5. Include LLDebugTool wherever you need it with `#import "LLDebug.h"` or you can write `#import "LLDebug.h"` in your .pch in your .pch file. ##### Swift -> 1. Add a pod entry for LLDebugToolSwift to your Podfile `pod 'LLDebugToolSwift' , '~> 1.0.0'`. -> 2. If only you want to use it only in Debug mode, Add a pod entry for LLDebugToolSwift to your Podfile `pod 'LLDebugToolSwift' , '~> 1.0.0' ,:configurations => ['Debug']`, Details also see [Wiki/Use in Debug environment](https://github.com/HDB-Li/LLDebugTool/wiki/Use-in-Debug-environment). If you want to specify the version, use as `pod 'LLDebugToolSwift' , '1.3.3' ,:configurations => ['Debug']`. -> 3. The recommended approach is to use multiple targets and only add `pod 'LLDebugToolSwift', '~> 1.0.0'` to Debug Target. This has the advantage of not contamiling the code in the Product environment and can be integrated into the App in the Archive Debug environment (if `:configurations => ['Debug']`, it can only run through XCode. It is not possible to Archive as an App). +> 1. Add a pod entry for LLDebugToolSwift to your Podfile `pod 'LLDebugToolSwift' , '~> 1.0'`. +> 2. If only you want to use it only in Debug mode, Add a pod entry for LLDebugToolSwift to your Podfile `pod 'LLDebugToolSwift' , '~> 1.0' ,:configurations => ['Debug']`, Details also see [Wiki/Use in Debug environment](https://github.com/HDB-Li/LLDebugTool/wiki/Use-in-Debug-environment). If you want to specify the version, use as `pod 'LLDebugToolSwift' , '1.3.4' ,:configurations => ['Debug']`. +> 3. The recommended approach is to use multiple targets and only add `pod 'LLDebugToolSwift', '~> 1.0'` to Debug Target. This has the advantage of not contamiling the code in the Product environment and can be integrated into the App in the Archive Debug environment (if `:configurations => ['Debug']`, it can only run through XCode. It is not possible to Archive as an App). > 4. Must be added in the Podfile **`use_frameworks!`**. > 5. Install the pod(s) by running `pod install`. If you can't search `LLDebugToolSwift` or you can't find the newest release version, running `pod repo update` before `pod install`. > 6. Include LLDebugTool wherever you need it with `import "LLDebugToolSwift`. @@ -324,7 +326,7 @@ LLDebugTool provides a screenshot and allows for simple painting and marking tha ### Hierarchy -LLDebugTool provides a view structure tool for viewing elements' properties and information in non-debug mode. +LLDebugTool provides a view structure tool for viewing or modify elements' properties and information in non-debug mode. ### Magnifier From 83d7dd6771f481b2a575c59edc863ee8196a7993 Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Thu, 31 Oct 2019 15:02:20 +0800 Subject: [PATCH 44/45] Update for 1.3.4 --- LLDebugTool.podspec | 2 +- LLDebugTool/DebugTool/LLDebugTool.m | 2 +- LLDebugToolDemo.xcodeproj/project.pbxproj | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/LLDebugTool.podspec b/LLDebugTool.podspec index 16105926..7e971931 100644 --- a/LLDebugTool.podspec +++ b/LLDebugTool.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LLDebugTool" - s.version = "1.3.3" + s.version = "1.3.4" s.summary = "LLDebugTool is a debugging tool for developers and testers that can help you analyze and manipulate data in non-xcode situations." s.homepage = "https://github.com/HDB-Li/LLDebugTool" s.license = "MIT" diff --git a/LLDebugTool/DebugTool/LLDebugTool.m b/LLDebugTool/DebugTool/LLDebugTool.m index d3073eb9..10e37f39 100644 --- a/LLDebugTool/DebugTool/LLDebugTool.m +++ b/LLDebugTool/DebugTool/LLDebugTool.m @@ -163,7 +163,7 @@ - (void)initial { // Set Default _isBetaVersion = NO; - _versionNumber = @"1.3.3"; + _versionNumber = @"1.3.4"; _version = _isBetaVersion ? [_versionNumber stringByAppendingString:@"(BETA)"] : _versionNumber; diff --git a/LLDebugToolDemo.xcodeproj/project.pbxproj b/LLDebugToolDemo.xcodeproj/project.pbxproj index ddef4eee..879fb67d 100644 --- a/LLDebugToolDemo.xcodeproj/project.pbxproj +++ b/LLDebugToolDemo.xcodeproj/project.pbxproj @@ -2610,7 +2610,7 @@ INFOPLIST_FILE = LLDebugToolDemo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 1.3.3; + MARKETING_VERSION = 1.3.4; PRODUCT_BUNDLE_IDENTIFIER = myCompany.HDB.LLDebugToolDemo; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -2631,7 +2631,7 @@ INFOPLIST_FILE = LLDebugToolDemo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 1.3.3; + MARKETING_VERSION = 1.3.4; PRODUCT_BUNDLE_IDENTIFIER = myCompany.HDB.LLDebugToolDemo; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; From c2798a69a1b8d2d5a449e90a0e035633bc8066ad Mon Sep 17 00:00:00 2001 From: HDB-Li <358149116@qq.com> Date: Thu, 31 Oct 2019 15:14:51 +0800 Subject: [PATCH 45/45] Fix warning. --- .../Component/Hierarchy/Function/NSObject+LL_Hierarchy.m | 5 ++++- .../Html/UserInterface/LLHtmlConfigViewController.m | 1 + .../Core/Others/EnumDescription/LLEnumDescription.m | 8 +++++++- LLDebugTool/Core/Others/Tool/LLTool.m | 3 +++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m index a631c377..a8cb2afa 100644 --- a/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m +++ b/LLDebugTool/Core/Component/Hierarchy/Function/NSObject+LL_Hierarchy.m @@ -285,7 +285,7 @@ - (void)LL_replaceAttributeString:(NSString *)newString key:(NSString *)key { [LLTool log:[NSString stringWithFormat:@"KeyPath:%@ isn't a NSAttributedString or nil", key]]; return; } - NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] initWithAttributedString:string]; + NSMutableAttributedString *attribute = string ? [[NSMutableAttributedString alloc] initWithAttributedString:string] : [[NSMutableAttributedString alloc] init]; [attribute replaceCharactersInRange:NSMakeRange(0, string.length) withString:newString]; [self setValue:string forKey:key]; } @@ -1223,6 +1223,8 @@ @implementation UIActivityIndicatorView (LL_Hierarchy) LLTitleCellModel *model1 = [[[LLTitleCellModel alloc] initWithTitle:@"Style" detailTitle:[LLEnumDescription activityIndicatorViewStyleDescription:self.activityIndicatorViewStyle]] noneInsets]; model1.block = ^{ [weakSelf LL_showActionSheetWithActions:[LLEnumDescription activityIndicatorViewStyles] currentAction:[LLEnumDescription activityIndicatorViewStyleDescription:weakSelf.activityIndicatorViewStyle] completion:^(NSInteger index) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" if (index <= UIActivityIndicatorViewStyleGray) { weakSelf.activityIndicatorViewStyle = index; } else { @@ -1230,6 +1232,7 @@ @implementation UIActivityIndicatorView (LL_Hierarchy) weakSelf.activityIndicatorViewStyle = index + (UIActivityIndicatorViewStyleMedium - UIActivityIndicatorViewStyleGray - 1); } } +#pragma clang diagnostic pop }]; }; [settings addObject:model1]; diff --git a/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.m b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.m index 6970a4cc..9636e710 100644 --- a/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.m +++ b/LLDebugTool/Core/Component/Html/UserInterface/LLHtmlConfigViewController.m @@ -42,6 +42,7 @@ - (void)viewDidLoad { } - (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; if ([self.headerTextField isFirstResponder]) { [self.headerTextField resignFirstResponder]; } diff --git a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m index d5f72416..fc719250 100644 --- a/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m +++ b/LLDebugTool/Core/Others/EnumDescription/LLEnumDescription.m @@ -521,12 +521,12 @@ + (NSString *)activityIndicatorViewStyleDescription:(UIActivityIndicatorViewStyl #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" NSArray *actions = @[@(UIActivityIndicatorViewStyleWhiteLarge),@(UIActivityIndicatorViewStyleWhite),@(UIActivityIndicatorViewStyleGray)]; -#pragma clang diagnostic pop #ifdef __IPHONE_13_0 if (@available(iOS 13.0, *)) { actions = @[@(UIActivityIndicatorViewStyleMedium),@(UIActivityIndicatorViewStyleLarge),@(UIActivityIndicatorViewStyleWhiteLarge),@(UIActivityIndicatorViewStyleWhite),@(UIActivityIndicatorViewStyleGray)]; } #endif +#pragma clang diagnostic pop for (NSNumber *num in actions) { NSString *style = [self activityIndicatorViewStyleDescription:[num integerValue]]; if (style) { @@ -634,12 +634,15 @@ + (NSString *)tableViewCellSeparatorStyleDescription:(UITableViewCellSeparatorSt + (NSArray *)tableViewCellSeparatorStyles { NSMutableArray *styles = [[NSMutableArray alloc] init]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" for (UITableViewCellSeparatorStyle i = UITableViewCellSeparatorStyleNone; i <= UITableViewCellSeparatorStyleSingleLineEtched; i++) { NSString *style = [self tableViewCellSeparatorStyleDescription:i]; if (style) { [styles addObject:style]; } } +#pragma clang diagnostic pop return [styles copy]; } @@ -758,12 +761,15 @@ + (NSString *)barStyleDescription:(UIBarStyle)style { + (NSArray *)barStyles { NSMutableArray *styles = [[NSMutableArray alloc] init]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" for (UIBarStyle i = UIBarStyleDefault; i <= UIBarStyleBlackTranslucent; i++) { NSString *style = [self barStyleDescription:i]; if (style) { [styles addObject:style]; } } +#pragma clang diagnostic pop return [styles copy]; } diff --git a/LLDebugTool/Core/Others/Tool/LLTool.m b/LLDebugTool/Core/Others/Tool/LLTool.m index f0614797..04e88e98 100644 --- a/LLDebugTool/Core/Others/Tool/LLTool.m +++ b/LLDebugTool/Core/Others/Tool/LLTool.m @@ -88,7 +88,10 @@ + (UIWindow *)topWindow { } + (UIWindow *)keyWindow { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" return [UIApplication sharedApplication].keyWindow; +#pragma clang diagnostic pop } + (void)log:(NSString *)string {