for...in... 循环 处理一组按钮的选中状态变动

for...in...  循环  处理一组按钮的选中状态变动

- (void)buttonAction:(UIButton *)button { 

[_indexView removeFromSuperview];
//下面线条移除
[_tabScrollView setContentOffset:CGPointMake(button.tag * _pageWidth, 0) animated:_transitionAnimated];

//下面两句话更改所有按钮的状态
for (UIButton *tempButton in _tabButtonArray) { if (button.tag != tempButton.tag) { [tempButton setSelected:NO]; } }
[button setSelected:YES];

if(button.selected) {

  _indexView.frame = CGRectMake(0, tabButton.frame.size.height - 2, tabButton.frame.size.width, 2);
           [tabButton addSubview:_indexView];

}
}
原文地址:https://www.cnblogs.com/OIMM/p/11475721.html