SOURCE http://blog.sina.com.cn/s/blog_59fb90df0101apn4.html, click here to view the original
as figure, the following is nested inside the cell , to tableview added a click event, jump to the View details interface, now I need to click the more buttons below, jump to see more friends interface, and click on the white space in the red circle does not respond , that is, do not jump to the view details screen.
Because it is in a cell , so I used a uiview to put up the hot friends, add uitapgesturerecognizer, and then do not operate in the method, The realization of the above click on the red circle of the white space will not jump to the viewing interface, equivalent to the UITapGestureRecognizer event covering the TableView Click event, but, when I am full of expectations of the run, yes, Click on the blank will not jump, but when I click More,UIButton Click event does not respond, after a round of Baidu search, in a blog to find a solution, blog address on the above, interested friends can see, blog summary:
After adding UITapGestureRecognizer to the view, all touch events on this view are absorbed by the UITapGestureRecognizer, so to solve this bug, To add some event filtering to this gesture agent, do not intercept the button event . The code is as follows :
UITapGestureRecognizer *tapgesture = [[UITapGestureRecognizer alloc]initwithtarget:self Action: @selector (CILCK)]; Tapgesture.delegate = self; [Friendview addgesturerecognizer:tapgesture]; #pragma mark uigesturerecognizerdelegate-(BOOL) Gesturerecognizer: ( Uigesturerecognizer *) Gesturerecognizer Shouldreceivetouch: (Uitouch *) touch{ if ([Touch.view isKindOfClass:[ UIButton class]) { //Leave button clicked to intercept return NO; else{ return YES; } }
ThanksThe original author's share, with the above code to successfully achieve the effect I want,button event also successfully responded.
This is recorded for later inspection.
IOS responds to button click events on UIView with UITapGestureRecognizer added