Fra*_*scu 11
最简单的方法是在删除之前使用框架和alpha.
你可以得到一些很酷的效果
-(void)removeWithEffect:(UIView *)myView
{
[UIView beginAnimations:@"removeWithEffect" context:nil];
[UIView setAnimationDuration:0.5f];
//Change frame parameters, you have to adjust
myView.frame = CGRectMake(0,0,320,480);
myView.alpha = 0.0f;
[UIView commitAnimations];
[myView performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:0.5f];
}
Run Code Online (Sandbox Code Playgroud)
iOS更新
您现在可以使用块来执行动画
[UIView animateWithDuration:0.5f
animations:^{view.alpha = 0.0;}
completion:^(BOOL finished){ [view removeFromSuperview]; }];
Run Code Online (Sandbox Code Playgroud)
如果您向上定向iOS 4.0,则可以使用动画块:
[UIView animateWithDuration:0.2
animations:^{view.alpha = 0.0;}
completion:^(BOOL finished){ [view removeFromSuperview]; }];
Run Code Online (Sandbox Code Playgroud)
(上面的代码来自Apple的UIView文档)
| 归档时间: |
|
| 查看次数: |
5519 次 |
| 最近记录: |