I have to do a bit of processing before my app can start printing, so I do that on a thread, and once it is all done, I do
dispatch_async(dispatch_get_main_queue(),^(){
ULIPrintableView *viewForPrinting = [[ULIPrintableView alloc] initWithData:data];
NSPrintOperation *operation = [NSPrintOperation printOperationWithView:viewForPrinting];
NSPrintPanel *panel = operation.printPanel;
ULIPrintAccessoryViewController *settingsVC = [ULIPrintAccessoryViewController new];
viewForPrinting.printOperation = operation;
settingsVC.printView = viewForPrinting;
[panel addAccessoryController:settingsVC];
[operation runOperation];
});
All works fine, except that for an NSScrollView (wrapping an NSTableView) in the accessory view.
That view scrolls perfectly with a regular wired PC mouse attached to the Mac, but with an Apple trackpad (both MacBook or the external one) and two-finger scrolling, the scroll view does not update until you remove your fingers from the trackpad.
It seems as if some sort of touch-moved events were not being delivered.
If I change the last line in the block from -runOperation
to -runOperationModalForWindow:delegate:didRunSelector:contextInfo:
scrolling is OK again, but I don't really have a window I could show this sheet on in my use case.
If I call either runOperation method directly instead of doing my threading the scroll view scrolls fine.