Skip to content

Instantly share code, notes, and snippets.

@qy1010
Created December 16, 2019 07:22
Show Gist options
  • Save qy1010/be3d245a7057f428618b92cd887065d3 to your computer and use it in GitHub Desktop.
Save qy1010/be3d245a7057f428618b92cd887065d3 to your computer and use it in GitHub Desktop.
UIView *myView = [[UIView alloc] init];
myView.frame = CGRectMake(0, 0, 50, 50);
myView.backgroundColor = [UIColor blackColor];
[self.view addSubview:myView];
[UIView animateWithDuration:2.0 animations:^{
// 2 秒内向右移动 100, 向下移动100。
myView.transform = CGAffineTransformMakeTranslation(100, 100);
} completion:^(BOOL finished) {
// 动画完成后的回调
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment