iOS点击按钮第二次不能旋转View

原因:

用CGAffineTransformMakeRotation,每次旋转都要在之前最后的角度基础之上再转才有效果。

- (void)clickAction: (UIButton *)button {
    NSLog(@"点击");
    if (!button.selected) {
        button.transform = CGAffineTransformMakeRotation(M_PI);
    } else {
        button.transform = CGAffineTransformIdentity;
    }
    button.selected = !button.selected;
}

posted on 2018-02-09 16:33  玉思盈蝶  阅读(209)  评论(0编辑  收藏  举报

导航