关于灰度层的showhide
Posted 偶阵雨ss33
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于灰度层的showhide相关的知识,希望对你有一定的参考价值。
原理图如下:
- (void)show{
UIWindow *win = [[UIApplication sharedApplication] keyWindow];
UIView *topView = [win.subviews objectAtIndex:0];
[topView addSubview:self];
[UIView animateWithDuration:0.1 animations:^{
[self layoutIfNeeded];
}];
}
- (void)hide{
[UIView animateWithDuration:0.1 animations:^{
self.alpha = 0;
[self layoutIfNeeded];
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
以上是关于关于灰度层的showhide的主要内容,如果未能解决你的问题,请参考以下文章