0

Is there a way to find out how many views are currently in the view-stack? Just curious to see how big its getting at any point when the code is pushing one view onto another...

Sirab33
  • 1,247
  • 3
  • 12
  • 27

1 Answers1

0

You should be able to add your own support for counting subviews recursively using a category on UIView:

@implementation UIView (SubviewCount)

- (NSUInteger)subviewCount
{
   NSUInteger count = [[self subviews] count];
   for (UIView *view in [self subviews])
      count += [view subviewCount];
   return count;
}

@end
Todd Yandell
  • 14,656
  • 2
  • 50
  • 37