ios - Handle tap on same segmented button? -


i'm trying handle tap event on segmented control, when selected button clicked again. example, screenshot below "second" selected, how handle action when "second" button clicked again?

i tried iboutlet, triggers when value has changed. tried code below, same thing triggers when value changes. in both cases while "second" selected, clicking "second" again not fire anything. there way this?

segmentedcontrol.addtarget(self, action: "segementedanytap:", forcontrolevents: .allevents) 

enter image description here

this works me, adding gesture recogniser uisegmentedcontrol

- (void)viewdidload {   [super viewdidload];    [self.segmentedcontrol addtarget:self action:@selector(valuechanged:) forcontrolevents:uicontroleventvaluechanged];   uitapgesturerecognizer *tapgesture = [[uitapgesturerecognizer alloc] initwithtarget:self action:@selector(touched:)];   [self.segmentedcontrol addgesturerecognizer:tapgesture]; }  - (void)valuechanged:(id)sender {   // value change code }  - (void)touched:(id)sender {   // code check if segmented controls index has not changed.   // execute desired functionality } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -