一个动画效果

一个动画效果

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];
}

posted on 2015-03-13 09:28  gcczhongduan  阅读(89)  评论(0编辑  收藏  举报