Reputation: 8472
I'm used to .net UI, and I am used to go inside the array of controls inside one container,
I am wondering about ui in cocoa-touch I can do the same, once I didn't find it out there
thanks
Upvotes: 0
Views: 242
Reputation: 56
You could do it by enumerating the subviews of that container view recursively, checking if they are subclasses of UIControl and adding them to an array. You could create a similar category to UIView(this code is completely untested)
- (NSArray*)containedControls
{
NSMutableArray *controls = [NSMutableArray array];
for(UIView *subview in self.subviews){
if([subview isSubclassOfClass:[UIControl class]])
[controls appendObject:subview]
else {
NSArray *containedInSubview = [subview containedControls];
[controls addObjectsFromArray:containedInSubview];
}
}
return controls;
}
Upvotes: 2