(Turn) [iOS] iOS uses View to add a full-screen mask to the screen

 Reprinted from: http://blog.csdn.net/qq_30963589/article/details/50580872

 

+(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];
}

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326350636&siteId=291194637