一个动画效果

一个动画效果

by 伍雪颖


#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
@interface ViewController ()
@end
@implementation ViewController

- (
void)viewDidLoad {
    [
super viewDidLoad];
   
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
    view.
backgroundColor = [UIColor redColor];
    [
self.view addSubview:view];
   
    view.
transform = CGAffineTransformMakeTranslation(SCREEN_WIDTH, 0);
    [
UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:0.7 initialSpringVelocity:0 options:0 animations:^{
        view.
transform = CGAffineTransformIdentity;
    }
completion:NULL];
}

原文地址:https://www.cnblogs.com/gcczhongduan/p/4334321.html