makeObjectsPerformSelector
这是数组用的方法,类似于for循环
makeObjectsPerformSelector:@selector(method:)
意为数组中的每个元素都执行method方法 obj是对象不能是基本数据类型
makeObjectsPerformSelector:@selector(method:) withObject:obj
例如:
1、按钮全部设置为选中状态
[self.selectedBtnArr makeObjectsPerformSelector:@selector(setSelected:) withObject:@(YES)];
2、将self.view的上的子视图逐一从父视图上移除
[self.View.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
网友评论