• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTextField not updated during large process
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField not updated during large process


  • Subject: Re: NSTextField not updated during large process
  • From: Koen van der Drift <email@hidden>
  • Date: Mon, 01 Oct 2012 18:11:40 -0400

On Oct 1, 2012, at 5:39 PM, Koen van der Drift <email@hidden> wrote:

>    [myQueue addOperationWithBlock:^(void)
>    {
>        [self parseData];	// calculate the new data and update the model
> 	}];
>
> // now tell everyone we're done
>    [self finishedTask];		// update the NSTableView and the UI


More confusion...

So, [self parseData] creates a new array which is shown in a table (bound to the resulting NSArray), but also needs to update another view. The table gets updated, but the other view not. As it turns out, once [self finishedTask] gets called, the array is still empty. I guess because the parsing is still going on in another thread.

I solved it as follows by adding another operation on the mainQueue inside the first queue:

- (void)doMyTask
{
   [self cleanUp];

   NSOperationQueue    *myQueue = [[NSOperationQueue alloc] init];

   [myQueue addOperationWithBlock:^(void)
   {
       [self parseData];	// calculate the new data and update the model

        [[NSOperationQueue mainQueue] addOperationWithBlock:^(void)
        {
  		 [self finishedTask];		// update the NSTableView and the UI
	}];
   }];
}

Is that a correct approach?


- Koen.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

References: 
 >Re: NSTextField not updated during large process (From: Koen van der Drift <email@hidden>)
 >Re: NSTextField not updated during large process (From: Koen van der Drift <email@hidden>)

  • Prev by Date: Re: FS item in trash
  • Next by Date: Re: NSTextField not updated during large process
  • Previous by thread: Re: NSTextField not updated during large process
  • Next by thread: Re: NSTextField not updated during large process
  • Index(es):
    • Date
    • Thread