Просмотр исходного кода

Add more shortcuts to UView and UIViewController

Tanner Bennett лет назад: 6
Родитель
Сommit
920727e375

+ 2 - 1
Classes/ObjectExplorers/FLEXObjectExplorerFactory.m

@@ -11,6 +11,7 @@
 #import "FLEXAlert.h"
 #import "FLEXClassShortcuts.h"
 #import "FLEXViewShortcuts.h"
+#import "FLEXViewControllerShortcuts.h"
 #import "FLEXImageShortcuts.h"
 #import "FLEXLayerShortcuts.h"
 #import "FLEXColorPreviewSection.h"
@@ -30,7 +31,7 @@ static NSMutableDictionary<Class, Class> *classesToRegisteredSections = nil;
             ClassKey(NSSet)            : [FLEXCollectionContentSection class],
             ClassKey(NSDictionary)     : [FLEXCollectionContentSection class],
             ClassKey(NSUserDefaults)   : [FLEXDefaultsContentSection class],
-//            ClassKey(UIViewController) : [FLEXViewControllerExplorerViewController class],
+            ClassKey(UIViewController) : [FLEXViewControllerShortcuts class],
             ClassKey(UIView)           : [FLEXViewShortcuts class],
             ClassKey(UIImage)          : [FLEXImageShortcuts class],
             ClassKey(CALayer)          : [FLEXLayerShortcuts class],

+ 10 - 6
Classes/ObjectExplorers/Sections/Shortcuts/FLEXShortcutsFactory+Defaults.m

@@ -17,9 +17,10 @@
 + (void)load {
     // Only available since iOS 3.2, but we never supported iOS 3, so who cares
     NSArray *ivars = @[@"_gestureRecognizers"];
+    NSArray *methods = @[@"sizeToFit", @"setNeedsLayout", @"removeFromSuperview"];
 
-    // UIVIew
-    self.append.ivars(ivars).properties(@[
+    // UIView
+    self.append.ivars(ivars).methods(methods).properties(@[
         @"frame", @"bounds", @"center", @"transform",
         @"backgroundColor", @"alpha", @"opaque", @"hidden",
         @"clipsToBounds", @"userInteractionEnabled", @"layer",
@@ -27,7 +28,7 @@
     ]).forClass(UIView.class);
 
     // UILabel
-    self.append.ivars(ivars).properties(@[
+    self.append.ivars(ivars).methods(methods).properties(@[
         @"text", @"attributedText", @"font", @"frame",
         @"textColor", @"textAlignment", @"numberOfLines",
         @"lineBreakMode", @"enabled", @"backgroundColor",
@@ -51,7 +52,7 @@
     ivars = @[@"_targetActions", @"_gestureRecognizers"];
 
     // UIControl
-    self.append.ivars(ivars).properties(@[
+    self.append.ivars(ivars).methods(methods).properties(@[
         @"enabled", @"allTargets", @"frame",
         @"backgroundColor", @"hidden", @"clipsToBounds",
         @"userInteractionEnabled", @"superview", @"subviews"
@@ -75,8 +76,11 @@
 + (void)load {
     // UIViewController
     self.append
-        .properties(@[@"view", @"title", @"navigationItem"])
-        .forClass(UIViewController.class);
+        .properties(@[
+            @"viewIfLoaded", @"title", @"navigationItem", @"toolbarItems", @"tabBarItem",
+            @"childViewControllers", @"navigationController", @"tabBarController", @"splitViewController",
+            @"parentViewController", @"presentedViewController", @"presentingViewController",
+        ]).methods(@[@"view"]).forClass(UIViewController.class);
 }
 
 @end

+ 1 - 1
Classes/ObjectExplorers/Sections/Shortcuts/FLEXViewControllerShortcuts.m

@@ -39,7 +39,7 @@
     // These additional rows will appear at the beginning of the shortcuts section.
     // The methods below are written in such a way that they will not interfere
     // with properties/etc being registered alongside these
-    return [self forObject:viewController additionalRows:@[@"Push View Controoller"]];
+    return [self forObject:viewController additionalRows:@[@"Push View Controller"]];
 }
 
 - (void (^)(__kindof UIViewController *))didSelectRowAction:(NSInteger)row {

+ 3 - 0
Classes/ObjectExplorers/Sections/Shortcuts/FLEXViewShortcuts.m

@@ -145,6 +145,9 @@
 
     // UIButton, private
     FLEXRuntimeUtilityTryAddObjectProperty(2, font, UIButton, UIFont, PropertyKey(ReadOnly));
+    
+    // UIViewController, public
+    FLEXRuntimeUtilityTryAddObjectProperty(3, toolbarItems, UIViewController, NSArray);
 }
 
 @end