IOS之UI添加动画

UIView提供了类方法beginAnimations开始一个动画,这种写法很像Java中jdbc中提交一个事务一样。

    [UIView beginAnimations:nil context:nil]; //设置动画开始

    [UIView setAnimationDuration:.8];//设置动画时间


//动画操作

    UIView *redBtn=[self.view viewWithTag:kRedBtnTag];

    CGAffineTransform transForm=redBtn.transform;

    redBtn.transform=CGAffineTransformRotate(transForm, sender.tag==7?-M_PI_4:M_PI_4);


    //提交动画结束

    [UIView commitAnimations];

你可能感兴趣的:(ios,UI,动画)