iphone - Button click not working when in presence of single Tap gesture -


i have view hierarchy follows

myviewcontroller --> scrollview(added via ib) --> imageview (+ zooming there) ---> button added on image view(added via code)

imageview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"map.png"]]; [scroll addsubview:imageview];  uibutton *mybutton = [uibutton buttonwithtype:uibuttontyperoundedrect];  mybutton.frame = cgrectmake(660, 120, 40, 40);  [mybutton settitle:@"10" forstate:uicontrolstatenormal];  [mybutton addtarget:self action:@selector(asiapressed:) forcontrolevents:uicontroleventtouchupinside];  [mybutton setenabled:yes]; [imageview addsubview:mybutton]; 

later on in view controller, defined selector as

-(void) asiapressed:(id)sender{ nslog(@"asiapressed clicked"); 

}

but never going inside selector..

pls help...i guess basic error..

thanks in advance

uiimageview has userinteractionenabled property set no default (and subviews) not receive touch events. need set property yes manually:

... imageview.userinteractionenabled = yes; ... 

p.s. mention gesture recognizer in question title, have not posted code - if present may cause problems, problem described above


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -