UIView点击事件。弹出视图,背景虚化。
2016-07-20 17:11
323 查看
@interface CountryViewController
//背景
@property (strong, nonatomic) UIView *BackView;
end
//设置背景虚化
-(UIView *)BackView{
if (!_BackView) {
_BackView = [[UIView alloc]initWithFrame:self.view.bounds];
//背景虚化
UIColor *myColor = [UIColor colorWithWhite:0.5 alpha:0.5];
_BackView.backgroundColor = myColor;
[self.view addSubview:self.BackView];
//设置在当前控制器前面
[self.view bringSubviewToFront:self.BackView];
//一开始隐藏
self.BackView.hidden = YES;
//添加点击事件
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(actiondo)];
[_BackView addGestureRecognizer:tapGesture];
}
return _BackView;
}
//实现方法
-(void)actiondo{
NSLog(@"1231231231231231231231231231231");
}
//设置一个按钮事件
-(void)click{
//显示UIview
self.BackView.hidden = NO;
}
//背景
@property (strong, nonatomic) UIView *BackView;
end
//设置背景虚化
-(UIView *)BackView{
if (!_BackView) {
_BackView = [[UIView alloc]initWithFrame:self.view.bounds];
//背景虚化
UIColor *myColor = [UIColor colorWithWhite:0.5 alpha:0.5];
_BackView.backgroundColor = myColor;
[self.view addSubview:self.BackView];
//设置在当前控制器前面
[self.view bringSubviewToFront:self.BackView];
//一开始隐藏
self.BackView.hidden = YES;
//添加点击事件
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(actiondo)];
[_BackView addGestureRecognizer:tapGesture];
}
return _BackView;
}
//实现方法
-(void)actiondo{
NSLog(@"1231231231231231231231231231231");
}
//设置一个按钮事件
-(void)click{
//显示UIview
self.BackView.hidden = NO;
}
相关文章推荐
- Ring3下Hook NtQueryDirectoryFile隐藏文件
- Media Queries
- [YY题]HDOJ5288 OO’s Sequence
- leetcode 375. Guess Number Higher or Lower II
- Android 开发最佳实践教程——MVPBuilder
- 自定义可动画展开收缩View的实现
- UICollectionView详解
- 40.You have statistics collected for some selected tables. Your requirement is that the statistics
- 让超出父视图范围的子视图响应事件,在UIView范围外响应点击
- uvaLive 3263 That Nice Euler Circuit 欧拉定理
- UIBezierPath
- 自定义View之MenuItemView
- 判断UitableView reloadData 结束的方法
- GStreamer SDK 1.0 Build Via Cerbero
- java -BolokingQueue
- button的常用属性和方法总结
- Leetcode 232. Implement Queue using Stacks (Easy) (cpp)
- UIPickerView
- 关于去除easy ui 的input textarea 等输入框点击有蓝色框框
- hbuilder学习记录