在 Cocoa Mac Os X Objective-C 应用程序中,如何在 PDFView 当前显示的 pdf 页面中实现搜索?
In a Cocoa Mac Os X Objective-C Application, How to implement a Search in the pdf page currently displayed by a PDFView?
我在 Cocoa 应用程序中搜索 PDFView 时遇到问题。现在我已经设置了一个 IBAction,其中包含用于选择特定单词 ("continue") 的代码,我知道该单词位于我的测试中的当前 pdf 页面中。但是 The Word 从未被选中,尽管我的代码正确地收集了 PDFSelection 对象数组,只发现了 1 次。我的代码是:
-(IBAction)sampleAction:(id)sender
{
NSArray *results = [self.pdfView.document findString:@"continue" withOptions:NSCaseInsensitiveSearch];
for (PDFSelection *pdfSel in results)
{
[pdfSel drawForPage:self.pdfView.currentPage active:YES];
}
[self.pdfView scrollSelectionToVisible:self];
}
然而,在当前显示的页面中,有继续字样,但我没有选择。请帮忙!
尝试查找下一个匹配项:
PDFSelection *pdfSel=[self.pdfView.document findString: @"continue"
fromSelection: self.pdfView.currentSelection
withOptions: NSCaseInsensitiveSearch];
if (pdfSel != nil)
{
[self.pdfView setCurrentSelection: pdfSel];
[self.pdfView scrollSelectionToVisible: self];
}
我在 Cocoa 应用程序中搜索 PDFView 时遇到问题。现在我已经设置了一个 IBAction,其中包含用于选择特定单词 ("continue") 的代码,我知道该单词位于我的测试中的当前 pdf 页面中。但是 The Word 从未被选中,尽管我的代码正确地收集了 PDFSelection 对象数组,只发现了 1 次。我的代码是:
-(IBAction)sampleAction:(id)sender
{
NSArray *results = [self.pdfView.document findString:@"continue" withOptions:NSCaseInsensitiveSearch];
for (PDFSelection *pdfSel in results)
{
[pdfSel drawForPage:self.pdfView.currentPage active:YES];
}
[self.pdfView scrollSelectionToVisible:self];
}
然而,在当前显示的页面中,有继续字样,但我没有选择。请帮忙!
尝试查找下一个匹配项:
PDFSelection *pdfSel=[self.pdfView.document findString: @"continue"
fromSelection: self.pdfView.currentSelection
withOptions: NSCaseInsensitiveSearch];
if (pdfSel != nil)
{
[self.pdfView setCurrentSelection: pdfSel];
[self.pdfView scrollSelectionToVisible: self];
}