设置动画,旋转

来源:互联网 发布:seo外包收费标准 编辑:程序博客网 时间:2024/06/06 11:34
   CGRect frame = self.imageView.frame;
    // 创建临时的图片,保留原图。一定要<span style="font-family: Menlo; font-size: 18px; color: rgb(187, 44, 162);">self</span><span style="font-family: Menlo; font-size: 18px;">.</span><span style="font-family: Menlo; font-size: 18px; color: rgb(79, 129, 135);">imageView</span><span style="font-family: Menlo; font-size: 18px;">.</span><span style="color: rgb(112, 61, 170); font-family: Menlo; font-size: 18px;">userInteractionEnabled</span><span style="font-family: Menlo; font-size: 18px;"> = </span><span style="font-family: Menlo; font-size: 18px; color: rgb(187, 44, 162);">YES</span><span style="font-family: Menlo; font-size: 18px;">;</span><div><span style="color: #000000"></span></div>    UIImageView* tempImageView = [[UIImageView alloc]initWithFrame:frame];    tempImageView.image = [UIImage imageNamed:@"1.jpg"];    [self.view addSubview:tempImageView];
    // 缩小    CGAffineTransform transform = CGAffineTransformMakeScale(0.1, 0.1);
    // 顺时针旋转,这里有位置变化,还没有想到在这个过程中旋转2周,现在是右转约半周    transform = CGAffineTransformRotate(transform, M_PI*1.99/2);
    // 设置目的地为右下角    CGPoint center = CGPointMake(self.view.bounds.size.width, self.view.bounds.size.height);    [UIView animateWithDuration:2 delay:0 usingSpringWithDamping:1 initialSpringVelocity:3 options:0 animations:^{        tempImageView.transform = transform;        tempImageView.center = center;    } completion:^(BOOL finished){        [tempImageView removeFromSuperview];    }];

0 0
原创粉丝点击