Multithreading and persistence - GCD

16 important questions on Multithreading and persistence - GCD

What is the basic idea of GCD?

The basic idea is that you have queues of operations.

How many types of queue's exist?

2 types:
serial queue (executed in order)
concurrent queue (execute in parallell)

How do we create a queue?

dispatch_queue_t dispatch_queue_create(const char *label, NULL)
NULL is serial queue
  • Higher grades + faster learning
  • Never study anything twice
  • 100% sure, 100% understanding
Discover Study Smart

What is dispatch_queue_t ?

Its the return type of the c function that creates a queue

Where do we use dispatch_queue_t for?

To handle our blocks of code

How do we put a block of code on our queue?

dispatch_async(dispatch_queue_t queue, ^(void)block)

Is a queue an object?

No

Can u use UIKit outside the main thread?

No, only in the main thread

If you dispatch something on the queue, can you stop it?

No, when its on the queue, it wil be executed

Do blocks keep strong pointers to the objects inside of it?

Yes, they do!

Where does UIRefreshControl inherit from?

It inherits from UIControl.

How can you set target-action in code? (UIrefreshControl)

[self.refreshControl addTarget:self
                                        action:@selector(refresh)
                      forControlEvents:UIControlEventValueChanged];

How can you make the refreshControl appear in code?

[self.refreshControl beginRefreshing];

How can you activate the network indicator?

UIApplication *myApplication = [UIApplication sharedInstance];
then set the property networkActivityIndicatorVisible
myApplication.networkActivityIndicatorVisible = YES:

How can you "Create" a spinning wheel?

Just drag it in in xcode, and then use its methods:
-(void) startAnimating
-(void) stopAnimanting

And maybe automatically hide the thing:
@property BOOL hideWhenStopped;


When you have trouble to elect the element you want, for contra; dragging, how van you easy select them in a little "popover" in xcode?

crt-shift + mouseklick

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo