ios - UITapGesture for Button are working. But, long press gesture for the same are not working -


i have table view x number of rows.

one of row has collection view inside it.

collection view has y number of cells.

every cell has button.

now, problem is; if apply tap gesture button inside collection view cell works. but, when apply long press gesture button not working @ all.

following code trying.

-(void)setupgestureforallbutton{     (uibutton *button in self.keyboardbuttons) {         uilongpressgesturerecognizer *gr = [[uilongpressgesturerecognizer alloc] init];         [gr addtarget:self action:@selector(userlongpressed:)];         [button addgesturerecognizer:gr];     } } - (void)userlongpressed:(id)sender {     nslog(@"user long pressed"); } - (bool)gesturerecognizer:(uigesturerecognizer *)gesturerecognizer shouldrecognizesimultaneouslywithgesturerecognizer:(uigesturerecognizer *)othergesturerecognizer {     return yes; } 

please find pictorial representation of problem enter image description here

update 1 :

setting gr.delegate = self; did trick.

i still not sure; then, why working tap gesture in first place.


Comments

Popular posts from this blog

php - trouble displaying mysqli database results in correct order -

depending on nth recurrence of job in control M -

sql server - Cannot query correctly (MSSQL - PHP - JSON) -