On Jul 20, 2012, at 07:13 PM, Markus Spoettl <ms_li...@shiftoption.com> wrote:
> On 7/20/12 6:28 PM, Martin Hewitson wrote: >> 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]; >> } >> } > > [self performSelectorOnMainThread:@selector(goToPage:) withObject:page > waitUntilDone:YES]; > > looks suspicious. If you're doing this on a secondary thread (which this line > implies), I'm pretty sure that at least the call to -makeFirstResponder: is > illegal (main thread only). Not sure about the PDF document class. No, it's all done on the main thread. Actually, using performSelectorOnMainThread... was just an attempt to get the thing to behave properly. Nominally I'm just calling -setCurrentSelectionAndAnimate: directly. The results are the same. Cheers, Martin > > Regards > Markus > -- > __________________________________________ > Markus Spoettl > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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/martin.hewitson%40aei.mpg.de > > This email sent to martin.hewit...@aei.mpg.de ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Martin Hewitson Albert-Einstein-Institut Max-Planck-Institut fuer Gravitationsphysik und Universitaet Hannover Callinstr. 38, 30167 Hannover, Germany Tel: +49-511-762-17121, Fax: +49-511-762-5861 E-Mail: martin.hewit...@aei.mpg.de WWW: http://www.aei.mpg.de/~hewitson ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com