• 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: How to update UI from a background thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to update UI from a background thread


  • Subject: Re: How to update UI from a background thread
  • From: Sandor Szatmari <email@hidden>
  • Date: Wed, 21 Sep 2016 12:01:07 -0400

In general, one simple form is:

dispatch_async( dispatch_get_main_queue(), ^{
// do UI updates on the main thread.
});

This can also be done with NSOperationQueue:

[[NSOperationQueue mainQueue] addOperationWithBlock:^{
// do UI updates on main thread.
}];

Sandor Szatmari

> On Sep 21, 2016, at 11:40, Dave <email@hidden> wrote:
>
> Hi All,
>
> How can I update my UI from a background thread?
>
> I have a method that does a LOT of intense processing, it calls a delegate method in my Window Controller which appends it to a Logging Scroll View, however nothing shows up in the Scroll View although it NSLog’s the string ok.
>
> Firstly is it ok to do this? When I tried it I got a CALayer error reported in the NSLog output.
>
> All the Best
> Dave
>
>
> _______________________________________________
>
> 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
_______________________________________________

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


  • Follow-Ups:
    • Re: How to update UI from a background thread
      • From: Dave <email@hidden>
References: 
 >How to update UI from a background thread (From: Dave <email@hidden>)

  • Prev by Date: How to update UI from a background thread
  • Next by Date: Re: How to update UI from a background thread
  • Previous by thread: How to update UI from a background thread
  • Next by thread: Re: How to update UI from a background thread
  • Index(es):
    • Date
    • Thread