답을 찾았으니 여기에 다른 방법이 있습니다. 당신이 그것을 제어 할 수
먼저 당신은 NSTextFinder의 인스턴스가 필요합니다. 우리는 이것을 코드로 설정했습니다.
textFinder = [[NSTextFinder alloc] init];
[textFinder setClient:textView];
[textFinder setFindBarContainer:[textView enclosingScrollView]];
[textView setUsesFindBar:YES];
[textView setIncrementalSearchingEnabled:YES];
첫 번째 대답 : 나는이 두 가지 중 하나를 할 수있는 시각적 인 피드백을 취소합니다. 난 그냥
[textFinder cancelFindIndicator];
... 시각적 피드백을 취소 할 수 있습니다 또는 나는 내 텍스트 뷰의 내용을 변경하려고 해요 NSTextFinder ...
[textFinder noteClientStringWillChange];
두 번째 대답을 경고 할 수있다 글로벌 NSFindPboard. 이를 사용하여 검색을 설정할 수 있습니다.
// change the NSFindPboard NSPasteboardTypeString
NSPasteboard* pBoard = [NSPasteboard pasteboardWithName:NSFindPboard];
[pBoard declareTypes:[NSArray arrayWithObjects:NSPasteboardTypeString, NSPasteboardTypeTextFinderOptions, nil] owner:nil];
[pBoard setString:@"new search" forType:NSStringPboardType];
NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], NSTextFinderCaseInsensitiveKey, [NSNumber numberWithInteger:NSTextFinderMatchingTypeContains], NSTextFinderMatchingTypeKey, nil];
[pBoard setPropertyList:options forType:NSPasteboardTypeTextFinderOptions];
// put the new search string in the find bar
[textFinder cancelFindIndicator];
[textFinder performAction:NSTextFinderActionSetSearchString];
[textFinder performAction:NSTextFinderActionShowFindInterface]; // make sure the find bar is showing
그래도 문제가 있습니다. 검색 막대의 실제 텍스트 필드는 해당 코드 다음에 업데이트되지 않습니다. 나는 ... 나는 첫 번째로 반응을 전환하면 그때가 업데이트받을 수 있다는 것을 발견
[myWindow makeFirstResponder:outlineView];
[myWindow makeFirstResponder:textView];