Quellcode durchsuchen

Filter out the description in the object explorer if it doesn’t match the search text.

Ryan Olson vor 12 Jahren
Ursprung
Commit
5012989fdb
1 geänderte Dateien mit 19 neuen und 1 gelöschten Zeilen
  1. 19 1
      Classes/Object Explorers/FLEXObjectExplorerViewController.m

+ 19 - 1
Classes/Object Explorers/FLEXObjectExplorerViewController.m

@@ -195,7 +195,25 @@ static const NSInteger kFLEXObjectExplorerScopeIncludeInheritanceIndex = 1;
 
 - (BOOL)shouldShowDescription
 {
-    return ![self objectIsClass] && [[FLEXUtility safeDescriptionForObject:self.object] length] > 0;
+    BOOL showDescription = YES;
+    
+    // Not for class objects (matches the title in the nav bar).
+    if (showDescription) {
+        showDescription = ![self objectIsClass];
+    }
+    
+    // Not if it's empty or nil.
+    NSString *descripition = [FLEXUtility safeDescriptionForObject:self.object];
+    if (showDescription) {
+        showDescription = [descripition length] > 0;
+    }
+    
+    // Not if we have filter text that doesn't match the desctiption.
+    if (showDescription && [self.filterText length] > 0) {
+        showDescription = [descripition rangeOfString:self.filterText options:NSCaseInsensitiveSearch].length > 0;
+    }
+    
+    return showDescription;
 }