瀏覽代碼

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

Ryan Olson 12 年之前
父節點
當前提交
5012989fdb
共有 1 個文件被更改,包括 19 次插入1 次删除
  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;
 }