标签:style class blog code tar color
在ViewDidLoad中调用
-(void)tapBackground //在ViewDidLoad中调用 { UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapOnce)];//定义一个手势 [tap setNumberOfTouchesRequired:1];//触击次数这里设为1 [self.view addGestureRecognizer:tap];//添加手势到View中 } -(void)tapOnce//手势方法 {
[self.view endEditing:YES];
}
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [self.view endEditing:YES]; }
标签:style class blog code tar color
原文地址:http://www.cnblogs.com/sosomaxba/p/3810020.html