wil*_* du 11 iphone animation objective-c uiview ios
我想点击一个按钮时将一个视图移动到右边.我写了些东西,但它不起作用;
UIView* view = [self.view viewWithTag:100];
if (!view) {
NSLog(@"nil");
}
[UIView animateWithDuration:0.3f
animations:^{
[view setTransform:CGAffineTransformMakeTranslation(-100, 0)];
}
completion:^(BOOL finished){
}
];
Run Code Online (Sandbox Code Playgroud)
Gur*_*uru 21
试试这段代码;
UIView* view = [self.view viewWithTag:100];
[UIView animateWithDuration:0.5
delay:0.1
options: UIViewAnimationCurveEaseOut
animations:^
{
CGRect frame = view.frame;
frame.origin.y = 0;
frame.origin.x = (-100);
view.frame = frame;
}
completion:^(BOOL finished)
{
NSLog(@"Completed");
}];
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
22140 次 |
最近记录: |