dzenbot/DZNSegmentedControl — pull request #22 by ndmeiri (2014-08-13 20:03:09+00:00)
Title: Add support for custom NSNumberFormatter

Refactored the internal structure slightly:
* Added a private @property that holds the counts for each segment. This was easier than trying to extract the count value from the button's title string. This was necessary since parsing the title string depended on the old NSNumberFormatter. For example, if the old formatter used NSNumberFormatterDecimalStyle but the new formatter used NSNumberFormatterPercentStyle or NSNumberFormatterCurrencyStyle, then an instance of the old formatter would have to be retained in order to successfully extract the count value out of the old title string. Hopefully this internal structure change will help in the future too.
* Removed a couple unnecessary @synthesize lines.
* Moved the work of setting a segment's title out of -setCount:forSegmentAtIndex: and into -configureButtonForSegment:
* Added a public @property for the custom NSNumberFormatter.
* Added overridden method -setNumberFormatter:.

Since the counts @property is private, -countForSegmentAtIndex: is still exposed in the header file. However, I opted to not add NSAssert statements to the implementation of this method. If a count for a non-existent segment is requested, then @(0) is returned. This may not be the right approach. Thoughts?