0

I am using a UISegmentedControl section to show an action sheet when pressed. The action sheet has 2 date pickers one to set a from date and one to set a to date.

When the action sheet is finished with it hides away and does what it needs to do, however I have noticed that the only way to get the action sheet back up is by selecting the another section of the UISegment and then to select the segment that shows the action sheet.

My question is, are there any methods of responding to another touch event on a specific segment of a UISegmentedControl that has already been selected?

I have already used selectedSegmentIndex in the code to show the action sheet.

Thanks in advance.

TinMan7757
  • 148
  • 2
  • 10
  • So are you saying you tap the first segment on you UISegmentedControl and it opens your date picker, but when you tap that same one again, after dismissing your date picker, the date picker is not shown again? – Justin Holman Sep 11 '14 at 17:10

1 Answers1

0

Sounds like what you're looking for is the momentary state for your UISegmentControl. This will be prevent the segment control from holding a selected position for any segment. Tapping a segment will act as a button instead of a tab-like selector.

You can do this in interface builder like so:

Segment Control options

Or you can do it in code:

segmentControl.momentary = YES

This solution will work if you don't need the segment control to show the currently selected segment. From your description, this seems fitting.

dbart
  • 5,468
  • 2
  • 23
  • 19