there's a button method :
-(void) buttonTapped:(id) sender{
dispatch_async(dispatch_queue_create("countQueue", NULL), ^{
sleep(10);
NSLog(@"%d",self.count++);
});
}
self.count is property:
@property (nonatomic, assign) int count;
I want to know if I create the "countQueue" many times by click the button ,
dispatch_queue_create()
creates a new queue , even if a queue with the same label already exists. The label is only meant as a tool to identify the queue during debugging. Arbitrary many queues with the same label can exist at the same time. dispatch_after()
. Edit: After reading your comment, I assume that there is a better solution to your problem, such as updating the property if the image download has actually finished. How to do this depends on the method used for the download. One example would be the completion handler of sendAsynchronousRequest:queue:completionHandler:
of NSURLConnection
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.