scrollview 上添加tableview , table
2017-02-13 本文已影响159人
失忆的程序员
//<UIGestureRcognizerDelegate> 需要实现
//添加手势
- (void)viewDidLoad {
[super viewDidLoad];
UITapGestureRecognizer *tapGes = [[UITapGestureRecognizer alloc] initWithTarget:selfaction:@selector(touch)];
tapGes.delegate =self;
[self.view addGestureRecognizer:tapGes];
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
if([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]) {
returnNO;
}
returnYES;
}
#pragma mark -添加手势
- (void)touch {
[self.view endEditing:YES];
}