iOS添加遮罩层
来源:互联网 发布:蓝牙数据写到 mic 编辑:程序博客网 时间:2024/06/07 23:38
添加遮罩层的原理是在一个可以操作的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]]; [view1 setAlpha:0.2];
[UIView animateWithDuration:.8 animations:^{
[self->addRenTV addSubview:view1];//addRenTV是主界面
}];
[view1 addSubview:view];
self->addRenTV.scrollEnabled = NO;
}];
* 其中,view1是下边的,所以移除时要移除view1,这也是为什么要把它定义成全局变量,如果在其他函数里实现移除就可以直接写:
[view1 removeFromSuperview];
阅读全文
0 0
- iOS添加遮罩层
- IOS添加自定义字体
- IOS添加自定义字体
- ios 添加通讯录资料
- iOS图标添加
- IOS添加日历事件
- IOS 添加自定义字体库
- IOS添加自定义字体
- ios添加联系人
- ios 图片添加阴影
- IOS添加自定义字体库
- IOS 添加自定义 字体
- ios动态添加控件
- IOS 添加渐变色
- IOS添加自定义字体
- iOS添加背景图片方法
- IOS 添加中文支持
- ios简单动画添加
- 后缀数组 小结
- hdu 1005 Number Sequence
- C语言基础之函数
- 使用Quartz任务调用的时候报错Based on configured schedule, the given trigger will never fire.
- MMU配置和使用
- iOS添加遮罩层
- C->C++注释转换的简单实现
- Python中的单行、多行、中文注释
- 数字签名工具signtool
- 虚拟机安装与快照
- for语句
- 树
- 《ASP.NET MVC企业实战》(一) MVC开发前奏
- coderUtil