遍历父视图上的button

时间:2021-01-12 21:10:27
 for (UIView * thebtn in [self.view subviews])
{
if ([thebtn isKindOfClass:[UIButton class]])
{ //***改变字体颜色
[(UIButton *)thebtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
//***改变背景
[(UIButton *)thebtn setBackgroundImage:nil forState:UIControlStateNormal];
}
}