ios点击键盘以外空白区域隐藏键盘
2012-09-06 13:59:27 来源:WEB开发网核心提示: 在view上添加一个UITapGestureRecognizer- (void)viewDidLoad{[super viewDidLoad];UITapGestureRecognizer *tapGr = [[UITapGestureRecognizer alloc] initWithTarget:self act
在view上添加一个UITapGestureRecognizer
- (void)viewDidLoad
{
[super viewDidLoad];
UITapGestureRecognizer *tapGr = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(viewTapped:)];
tapGr.cancelsTouchesInView = NO;
[self.view addGestureRecognizer:tapGr];
}
-(void)viewTapped:(UITapGestureRecognizer*)tapGr{
[activitySearchBar resignFirstResponder];
}
更多精彩
赞助商链接