添加遮罩层的原理是在一个可以操作的UIView下面有另一个UIView,下边的UIView的作用是遮挡住页面,使其无法进行操作,直到前一个界面的操作结束,然后直接将后一个UIView移除,代码如下:
[UIView animateWithDuration:0.4 animations:^{
int iconWidth=delegate.currentWidth/2;
UIView *view=[[UIView alloc]initWithFrame:CGRectMake(iconWidth-60,140,150,105 )];
[view setBackgroundColor:[UIColor colorWithRed:255.f/255.f green:255.f/255.f blue:255.f/255.f alpha:1]];
view.layer.cornerRadius=10;
view.backgroundColor = [UIColor colorWithRed:255. green:55. blue:255. alpha:0.89f];
view.layer.borderColor = [[UIColor lightGrayColor] CGColor];
view.layer.borderWidth = 2.0f;
//view.layer.cornerRadius = 10.0f;
view.clipsToBounds = YES;
view1 = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
//view1.backgroundColor = [UIColor colorWithRed:.255 green:.255 blue:.0 alpha:.255];
[view1 setBackgroundColor:[UIColor whiteColor]];