参考:
如果想要变化顺滑一点,可以加个动画。比如:
- (void)clickSelectBtn:(UIButton *)btn{
btn.selected = !btn.selected;
if (btn.selected == YES) {
// 改变箭头
[UIView animateWithDuration:0.5 animations:^{
btn.imageView.transform = CGAffineTransformRotate(btn.imageView.transform, M_PI);
}];
} else {
[UIView animateWithDuration:0.5 animations:^{
btn.imageView.transform = CGAffineTransformRotate(btn.imageView.transform, -M_PI);
}];
}
}