这个案例是在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;}]
}
}]