Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Now I see the problem.</p> <p>When you update the <code>message</code> property, it doesn't fire redrawing the view right away. The view is marked as 'needed to be drawn', and the actual drawing happens later, typically at the end of the current or next runloop in the main thread.</p> <p>Therefore, while your <code>didPresentAlertView</code> method is running on the main thread, the alert view is not redrawn until the method is finished. This is why a computation-intensive job needs to run on a separate thread to increase the responsiveness of the UI, as the UI-related job is done on the main thread.</p> <p>What you should do is run your <code>//A lot of code</code> <code>//more code</code> and <code>//even more code</code> on a separate thread, and update the <code>message</code> property on the main thread.</p> <p>For example, your code may look similar to :</p> <pre><code> // this is inside didPresentAlertView method NSOperationQueue* aQueue = [[NSOperationQueue alloc] init]; [aQueue addOperationWithBlock: ^{ // A lot of code [alert performSelector:@selector(setMessage:) onThread:[NSThread mainThread] withObject:@"Checking history" waitUntilDone:NO]; // more code [alert performSelector:@selector(setMessage:) onThread:[NSThread mainThread] withObject:@"writing history" waitUntilDone:NO]; // it goes on }]; </code></pre> <p>If you are working with iOS 4.0 and later, and want to use the GDC, be careful because it may detect independency of your computation and message updates and let them happen concurrently (which is not desired here). </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload