IPhone enumerateGroupsWithTypes finish selector

I use

[assetsLibrary enumerateGroupsWithTypes:groupTypes usingBlock:listGroupBlock failureBlock:failureBlock];

to list photo albums.

An enumerator acts as an “asynchronous” method, in other words, methods are returned before all elements are enumerated.

How do I know when the listing is complete?

I populate NSMutableArray with groups and call [myTableView reloadData]after the enumeration is complete.

+3
source share
2 answers

Your listing will give your block a group of null pointers and stop true when the last pass has passed. You can use this to set a flag or call some termination code using the performSelectorOnMainThread function: the next time you go through RunLoop.

+10
source

API , , . , , - , . , .

, , , . :

, . X (0.1, ?), , , . performSelectorOnMainThread: . , , .

, , , .

0

Source: https://habr.com/ru/post/1753532/


All Articles