-2

Any of you knows how can I can get the list of subviews on view?. there is a way to get the list into in array?

NSMutableArray *subviews= .... //all my subviews
Juan
  • 627
  • 2
  • 9
  • 27
  • 2
    You should read the manual... [UIView Class reference](http://developer.apple.com/library/ios/#documentation/uikit/reference/uiview_class/UIView/UIView.html#//apple_ref/doc/uid/TP40006816-CH3-SW17) has the answer – poncha Feb 03 '13 at 07:29

1 Answers1

10

You can do in this way

- (void)listSubviewsOfView:(UIView *)view {

    // Get the subviews of the view
    NSArray *subviews = [view subviews];

    // Return if there are no subviews
    if ([subviews count] == 0) return;

    for (UIView *subview in subviews) {

        NSLog(@"%@", subview);

        // List the subviews of subview
        [self listSubviewsOfView:subview];
    }
}

Please go through this link How to list out all the subviews in a uiviewcontroller in iOS?

Community
  • 1
  • 1
Saurabh Shukla
  • 1,368
  • 3
  • 14
  • 26