2

I have an app that generates a PDF and displays it at the same time. As expected, there is about a 2-second delay between pressing the "Generate PDF" button and the QLPreviewController presenting the document. Not only that, it appears as though the document fades in momentarily, freezes, and then completes the fade-in.

I understand that the reason for the delay is because it is generating the PDF first, but the design of the application doesn't allow for any other mechanism. I was hoping to put a brief "LOADING..." animation before the QLPreviewController view appears, but everything I've tried so far still presents a 2-second delay.

Can anyone provide guidance on what I might be able to do here?

achiral
  • 601
  • 2
  • 11
  • 24

1 Answers1

0

There are lots of options. I'd suggest that whatever you do, it be asynchronous. This will allow for the UI to not 'freeze' and you can put a loading screen up even if it is for 2 seconds.

There are many ways to implement this. Some involve actual background threads and others don't.

You can use, delegates, NSNotifications, blocks, NSOperations, and/or Grand Central Dispatch.

Here's a tutorial on how to use Grand Central Dispatch

Here's a tutorial on blocks

valheru
  • 2,552
  • 3
  • 20
  • 40