如何用iOS的View在屏幕上添加一个全屏的遮罩层?
- 内容介绍
- 文章标签
- 相关推荐
本文共计94个文字,预计阅读时间需要1分钟。
plaintext使用UIView添加覆盖视图:view=[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);view.backgroundColor=[UIColor blackColor];view.alpha=0.5;
+(UIView*)addCoverView{
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
view.backgroundColor = [UIColor blackColor];
view.alpha = 0.5;
[[UIApplication sharedApplication].keyWindow addSubview:view];
return view;
}
+(void)removeCoverView:(UIView*)view{
[view removeFromSuperview];
}
本文共计94个文字,预计阅读时间需要1分钟。
plaintext使用UIView添加覆盖视图:view=[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height);view.backgroundColor=[UIColor blackColor];view.alpha=0.5;
+(UIView*)addCoverView{
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)];
view.backgroundColor = [UIColor blackColor];
view.alpha = 0.5;
[[UIApplication sharedApplication].keyWindow addSubview:view];
return view;
}
+(void)removeCoverView:(UIView*)view{
[view removeFromSuperview];
}

