iOS给背景添加点击事件
当点击背景的时候出发事件,或者跳转界面或者产生其他的响应
-(void)viewDidLoad
{
UIImageView * imageView = [UIImageView alloc]initWithFrame:CGRectmake
(20,20,200,100)] ;
imageView.image = [UIImage imageName:@"aa.png"];
imageView.userInterationEnable = YES;
//主要的事应用这个类的方法
UITapGesturRecognizer * TapGesturRecognizer = [UITapGestureRecognizer alloc]
initWithTarget:self action:@selecter(tapGestureRecognizer);
[imageView addGestureRecognizer:TapGesturRecognizer ];
[self.view addSubview:imageView];
}
//点击图片时,释放掉textfile的键盘
-(void)tapGestureRecognizer
{
[self.textfile resignFirstRsponder];
补充:移动开发 , IOS ,