Enumeration (Nsenumerator)
collection classes (such as: Nsarray, Nsset, Nsdictionary, and so on) can be obtained to Nsenumerator, an abstract class that does not have a public interface for creating instances, through Objectenumerator to the request enumerator, You can use the Reverseobjectenumerator method if you want to browse the collection from behind. The Nsenumerator Nextobject method iterates through each collection element and ends with the return of nil, which is used in conjunction with a while to iterate through all the items in the collection.
Example 1:
Nsenumerator *enumerator; = [array objectenumerator];
ID element;
while (element = [Enumerator nextobject]) {
NSLog (@ "I found%@", Element);
}
Example 2:
Mbprogresshud in the source code through the enumeration found to add to the top of the view HUD.
+ (Mbprogresshud *) Hudforview: (UIView *) View {
Nsenumerator *subviewsenum = [View.subviews reverseobjectenumerator ];
For (UIView *subview in subviewsenum) {
if ([Subview iskindofclass:self]) {return
(Mbprogresshud *) Subview;
}
return
nil;
}