TYAlertControllerDemo
1,视图展示 show
if (self.superview == nil) {
[kCurrentWindow addSubview:self]; // 如果没有父视图的话
}
//下面是展示动画效果.
self.alpha = 0;
_alertView.transform = CGAffineTransformScale(_alertView.transform,0.1,0.1);
[UIView animateWithDuration:0.3 animations:^{
_alertView.transform = CGAffineTransformIdentity;
self.alpha = 1;
}];
2.视图隐藏
- (void)hide
{
if (self.superview) {
[UIView animateWithDuration:0.3 animations:^{
_alertView.transform = CGAffineTransformScale(_alertView.transform,0.1,0.1);
self.alpha = 0;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
}
网友评论