怎么根据tag值取出相应的控件

来源:互联网 发布:模糊算法控制特点 编辑:程序博客网 时间:2024/04/30 04:45
//根据tag查找

UILabel *find_label = (UILabel *)[self.view viewWithTag:123]; find_label.backgroundColor = [UIColor redColor];


我觉得在循环 遍历用tag标记,查找比较常见
//另一种根据tag查找

for (UIView *find_label in self.view.subviews) {if (find_label.tag == 123){find_label.backgroundColor = [UIColor redColor];}}


0 0