设置父视图的透明度不影响子视图的透明度
2016-01-05 13:35
399 查看
UIView *BGView = [[UIView alloc]initWithFrame:frame]; BGView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];//设置父视图的透明度不影响子视图的透明度 [self addSubview:BGView]; AlertBgView = [[UIView alloc]initWithFrame:CGRectMake(WIDTH/4, HEIGHT/3, WIDTH/2, HEIGHT/3)]; AlertBgView.center = self.center; AlertBgView.backgroundColor = [UIColor clearColor]; [BGView addSubview:AlertBgView]; UITableView *Table = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(AlertBgView.frame), CGRectGetHeight(AlertBgView.frame)) style:UITableViewStylePlain]; Table.layer.masksToBounds = YES; Table.layer.cornerRadius = 10; Table.delegate = self; Table.dataSource = self; [AlertBgView addSubview:Table]; NSArray *Arr = @[@"确定",@"取消"]; for (int index = 0; index < 2; index ++) { UIButton *button = [UIButton buttonWithType: UIButtonTypeCustom]; button.frame = CGRectMake(CGRectGetWidth(AlertBgView.frame)/2*index, CGRectGetMaxY(Table.frame)+10, CGRectGetWidth(AlertBgView.frame)/2, 30); button.layer.cornerRadius = 10; [button setTitle:Arr[index] forState:UIControlStateNormal]; button.backgroundColor = [UIColor orangeColor]; button.layer.masksToBounds = YES; [AlertBgView addSubview:button]; }
相关文章推荐
- 验证正则表达式
- Eclipses中嵌入API文档
- Verification和Identification区别
- jQuery 二级联动
- leetcode_twosum
- C语言结构体(struct)常见使用方法
- 一道js的面试题目
- 利用JDBC连接Oracle数据库
- 不找代理商
- 安全趋势:
- Application windows are expected to have a root view controller at the end of application launch
- php 的stdClass类的简单实用
- 简单调查HTMLayout
- Eclipse中SVN的安装步骤(两种)和使用方法
- win7下ping不是内部或外部命令
- awk命令笔记
- 互联网大数据挖掘与处理
- ViewPager + Fragment+radiogroup实现滑动标签页
- Servies
- tail -f 多次grep过滤输出