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

∥☆過路亽.° 提交于 2020-01-16 02:17:29

 

 

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];    }
}

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!