I am trying to understand pdfkit, and the apple example PDFKitViewer.
I have a pdf that I want to search (which is working in the apple example), but of course not in my version.
Most confusing is this snippet.
adapted from
First, I am not sure why a copy is added to _searchResults, and why it is also not released.
Second, when I try to use the "instance" in my program, I get "-[NSConcreteNotification pages]: unrecognized selector sent to instance". The NSLog line does work in the apple example. The apple example is a single class, so what am I overlooking?
Third, why is a PDFSelection returned, and not a NSNotification with PDFSelection as an object, as is "normally" done?
Thanks
I have a pdf that I want to search (which is working in the apple example), but of course not in my version.
Most confusing is this snippet.
Code:
- (void) didMatchString:(PDFSelection *) instance{
// Add page label to our array.
PDFSelection *searchHit = (PDFSelection *)[instance copy];
[pdfSearchResults addObject:searchHit];
[searchHit release];
// Force a reload.
[pdfSearchResultsView reloadData];
NSLog(@"\n%@\n",[[[[instance copy] pages] objectAtIndex: 0] label]); \\does not work
}
adapted from
Code:
- (void) didMatchString: (PDFSelection *) instance{
// Add page label to our array.
[_searchResults addObject: [instance copy]];
// Force a reload.
[_searchTable reloadData];
NSLog(@"\n%@\n",[[[[instance copy] pages] objectAtIndex: 0] label]); \\ works fine
}
First, I am not sure why a copy is added to _searchResults, and why it is also not released.
Second, when I try to use the "instance" in my program, I get "-[NSConcreteNotification pages]: unrecognized selector sent to instance". The NSLog line does work in the apple example. The apple example is a single class, so what am I overlooking?
Third, why is a PDFSelection returned, and not a NSNotification with PDFSelection as an object, as is "normally" done?
Thanks