uibutton - Detect a touch on a subview in a main controller -


i have main view controller class contains uiscrollview , number of subviews cards.

each card object , covered uibutton. want detect tap on uibutton , want disallow taps on multiple cards @ time.

i understand question partially . see if following helpful :

in scroll view :

 (int i=0;i<array;i++)  {        uibutton *button=[[uibutton alloc]initwithframe:cgrectmake(scrollwidth, 5,50,40)];        button.userinteractionenabled=yes;        uitapgesturerecognizer *rcognizer=[[uitapgesturerecognizer alloc]initwithtarget:self action:@selector(buttonselcted:)];        [button addgesturerecognizer:rcognizer];        [scrollview addsubview:button];        scrollwidth=scrollwidth+80;   } 

in buttonselected method following :

-(void)buttonselected:(uitapgesturerecognizer *)recognizer {     uibutton *selecteditem=(uibutton*)recognizer.view;     //do want button } 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -