Przeglądaj źródła

Support searching for view pointer address in FLEXHierarchyTableViewController

Tai Vuong 10 lat temu
rodzic
commit
37aec6dacc

+ 4 - 1
Classes/ViewHierarchy/FLEXHierarchyTableViewController.m

@@ -106,7 +106,10 @@ static const NSInteger kFLEXHierarchyScopeFullHierarchyIndex = 1;
     if ([self.searchBar.text length] > 0) {
     if ([self.searchBar.text length] > 0) {
         self.displayedViews = [candidateViews filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(UIView *candidateView, NSDictionary *bindings) {
         self.displayedViews = [candidateViews filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(UIView *candidateView, NSDictionary *bindings) {
             NSString *title = [FLEXUtility descriptionForView:candidateView includingFrame:NO];
             NSString *title = [FLEXUtility descriptionForView:candidateView includingFrame:NO];
-            return [title rangeOfString:self.searchBar.text options:NSCaseInsensitiveSearch].location != NSNotFound;
+            NSString *candidateViewPointerAddress = [NSString stringWithFormat:@"%p", candidateView];
+            BOOL matchedViewPointerAddress = [candidateViewPointerAddress rangeOfString:self.searchBar.text options:NSCaseInsensitiveSearch].location != NSNotFound;
+            BOOL matchedViewTitle = [title rangeOfString:self.searchBar.text options:NSCaseInsensitiveSearch].location != NSNotFound;
+            return matchedViewPointerAddress || matchedViewTitle;
         }]];
         }]];
     } else {
     } else {
         self.displayedViews = candidateViews;
         self.displayedViews = candidateViews;