Forráskód Böngészése

Fix view/controller preview image issue (#493)

Chaoshuai Lü 5 éve
szülő
commit
a3fa7bbadc

+ 3 - 3
Classes/ObjectExplorers/Sections/Shortcuts/FLEXLayerShortcuts.m

@@ -15,11 +15,11 @@
 + (instancetype)forObject:(CALayer *)layer {
     return [self forObject:layer additionalRows:@[
         [FLEXActionShortcut title:@"Preview Image" subtitle:nil
-            viewer:^UIViewController *(id layer) {
+            viewer:^UIViewController *(CALayer *layer) {
                 return [FLEXImagePreviewViewController previewForLayer:layer];
             }
-            accessoryType:^UITableViewCellAccessoryType(id layer) {
-                return UITableViewCellAccessoryDisclosureIndicator;
+            accessoryType:^UITableViewCellAccessoryType(CALayer *layer) {
+                return CGRectIsEmpty(layer.bounds) ? 0 : UITableViewCellAccessoryDisclosureIndicator;
             }
         ]
     ]];

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

@@ -73,13 +73,15 @@
                 return controller ? UITableViewCellAccessoryDisclosureIndicator : 0;
             }
         ],
-        [FLEXActionShortcut title:@"Preview Image" subtitle:nil
-            viewer:^UIViewController *(id view) {
+        [FLEXActionShortcut title:@"Preview Image" subtitle:^NSString *(UIView *view) {
+                return !CGRectIsEmpty(view.bounds) ? @"" : @"Unavailable with empty bounds";
+            }
+            viewer:^UIViewController *(UIView *view) {
                 return [FLEXImagePreviewViewController previewForView:view];
             }
             accessoryType:^UITableViewCellAccessoryType(UIView *view) {
                 // Disable preview if bounds are CGRectZero
-                return CGRectIsEmpty(view.bounds) ? UITableViewCellAccessoryDisclosureIndicator : 0;
+                return !CGRectIsEmpty(view.bounds) ? UITableViewCellAccessoryDisclosureIndicator : 0;
             }
         ]
     ]];