The ideal way to update UI using background thread is
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){
//Background Thread
dispatch_async(dispatch_get_main_queue(), ^(void){
//Run UI Updates
});
});
But we can update UI even without using main queue using
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){
//Background Thread
//Run UI Updates
});
So I am using beizer path to draw some points and those points are coming from iPad UIPanGestureRecognizer. Now I draw those points on main thread and also rotate those points to get new points and draw those new points using background thread(concurrent). Here is my code:
CGPoint touchPoint = [sender locationInView:self.view];
[pencilLayer[0] addPoint:touchPoint];
for(int i = 1; i < 4; i++)
{
dispatch_async(privateQueue, ^{
CGPoint point = Rotatepoint(500, 500, 45(degree), touchPoint);
[pencilLayer[i] addPoint:point];
});
}
My Question is: The main thread and private queue should draw on UI simultaneously. Why after releasing the gesture, privateQueue draw points on UI?