Dear list,

In my app I have a user action which allows them to select a particular line in 
a PDFView. The relevant method (on my PDFView subclass) looks like this.

- (void)displayLineAtPoint:(NSPoint)point inPageAtIndex:(NSUInteger)pageIndex
{
  if (pageIndex < [[self document] pageCount]) {
    [[self window] makeFirstResponder:self];
    PDFPage *page = [[self document] pageAtIndex:pageIndex];
    PDFSelection *sel = [page selectionForLineAtPoint:point];
    [self performSelectorOnMainThread:@selector(goToPage:) withObject:page 
waitUntilDone:YES];
    [self setCurrentSelection:sel];
    [self scrollSelectionToVisible:self];
    [self display];
    [self setCurrentSelection:nil];
    [self performSelector:@selector(setCurrentSelectionAndAnimate:) 
withObject:sel afterDelay:0.2];
  }
}

The problem is that I have to call this twice to get the desired effect. On the 
first call the view scrolls to the correct page but the selection is not shown. 
Only on the second call is the selection shown.

Does anyone have any experience with PDFView and selections? Is there are more 
reliable way to do what I want?

Cheers,

Martin

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to