Tuesday, 3 December 2013

Accessing subviews of a subview

For accessing individual buttons (subviews) of a main view depending on its tag,


 UIView *v = [self.view viewWithTag:k];
        if ([v isKindOfClass:[UIButton class]])
        {
            [v setAlpha:1.0];
        }

But if are having a hierarchy like, 
self.view -> scrollview-> buttons,
for accessing those buttons,

 UIView *v = [self.favScrollView viewWithTag:k];
        if ([v isKindOfClass:[UIButton class]])
        {
            [v setAlpha:1.0];
        }

here buttons are direct subviews for scrollview instead of main view.



No comments:

Post a Comment