iOS 通过tag查找控件

//比如创建一个UIImageView到view上
UIImageView *imageView = [[UIImageView allc] init];
imageView.tag = 10001; //需要设置一个tag   
[self.view addSubView:imageView];

//在别处使用的时候可以通过tag得到imageView对象
UIImageView *imageView = (UIImageView *)[self viewWithTag:10001];

  

原文地址:https://www.cnblogs.com/wb145230/p/4386525.html