uiview动画使用案例

来源:互联网 发布:java虚拟机设置内存 编辑:程序博客网 时间:2024/05/29 16:20

这个案例是在ios9.0之后项目中实现的自定义一个uiview移动到屏幕中间位置

首先定义一个uiview子视图,这里不再书写

在按钮事件内写入:

[UIView animateWithDuration:2.0f animations:^{

self._view.center=CGPointMake(CGRectGetWith(self.view.frame)-CGRectGetWith(self.view.frame)/2),CGRectGetHeight(self.view.frame)-CGRectGetHeight(self.view.frame)/2);}completion:^(BOOL finished){

[UIView animateWithDuration:2.0f animations:^{self._view.alpha=0.0f;}]

}

}]

0 0
原创粉丝点击