做这个:
NSMutableArray *arrSameViewTag = [NSMutableArray array];
for(UIView *subview in [yourView subviews]) //your view to find subview
{
if(subview.tag == 123) //specific tah here
{
[arrSameViewTag addObject:subview]; //view found add in array
}
}
NSlog(@"arrSameViewTag : %@",arrSameViewTag);
要找到特定的 UIButton 或任何 UIElement,然后像这样:
NSMutableArray *arrSameViewTag = [NSMutableArray array];
for(id *subview in [yourView subviews]) //your view to find subview
{
if([subview isKindofClass[UIButton class]) //any UIElement of specific type here
{
UIButton *btn = (UIButton *)subview; //same UIElement mentioned for checking it
if(btn.tag == 123) //specific tah here
{
[arrSameViewTag addObject:subview]; //view found add in array
}
}
}
NSlog(@"arrSameViewTag : %@",arrSameViewTag)