1. 程式人生 > >iOS 檢視/控制元件旋轉和復原

iOS 檢視/控制元件旋轉和復原

- (void)tnClick:(UIButton *)btn {

   [UIViewanimateWithDuration:0.5animations:^{

        // 旋轉  

CGAffineTransform transform =CGAffineTransformMakeRotation(M_PI/4);

        [btn setTransform:transform];

    } completion:^(BOOL finished) {

// 復原

        btn.transform = CGAffineTransformIdentity;

    }];

}