HMSegmentedControl
HMSegmentedControl copied to clipboard
Add an method to handle select common segment
To handle touch common segment, it is need to add a condition.
if (segment != self.selectedSegmentIndex && segment < sectionsCount) { // Check if we have to do anything with the touch event if (self.isTouchEnabled) [self setSelectedSegmentIndex:segment animated:self.shouldAnimateUserSelection notify:YES]; }else { //Handle the index not changed if (self.indexChangeBlock) { self.indexChangeBlock(segment, NO); } }
and use the origin indexChangeBock to add a parameter to judge if the index is changed:
typedef void (^IndexChangeBlock)(NSUInteger index, BOOL isChange)
With minimal changes, it is easier for users to handle different events,I sincerely hope that the owner can adopt this submission to make it more convenient for developers