-2

it doesn't hide label if I call inside dispatch blocks:

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        //Here your non-main thread.
        [self.loading setHidden:NO];


        dispatch_async(dispatch_get_main_queue(), ^{
            //Here you returns to main thread.
            [self.loading setHidden:NO];
        });
    });

This works, but still not hiding:

 [self.loading setHidden:NO];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        //Here your non-main thread.



        dispatch_async(dispatch_get_main_queue(), ^{
            //Here you returns to main thread.
            [self.loading setHidden:NO];
        });
    });

How can I access to IBOutlets inside blocks?

4

1 回答 1

2

你永远不会打电话setHidden:YES来隐藏它。另外,你对界面做的任何事情,你都应该在主线程上做。

于 2013-08-12T22:19:32.500 回答