hons82 / THSegmentedPager

Simple plugin-sample using the HMSegmentedControl and a UIPageViewController to show Tabs
Other
219 stars 52 forks source link

UIControlEventValueChanged for HMSegmentedControl not called on page swipe. #24

Open zeeshankhan opened 8 years ago

zeeshankhan commented 8 years ago

Hi,

When we swipe pages, HMSegmentedControl's UIControlEventValueChanged event is not getting triggered. I've added an action to pageControl which listens to UIControlEventValueChanged event. which is not getting called on page swipe. Any help? I tried adding an observer to selectedSegmentIndex property of pageControl, but this is not working on right swipe gesture. I even tried finding swipe gesture of pageViewController but that property is nil. The solution I see is to expose - (void)setSelectedSegmentIndex:(NSUInteger)index animated:(BOOL)animated notify:(BOOL)notify function from HMSegmentedControl class and call it on didFinishAnimating of UIPageViewController with notify=true.

@hons82 Please let me know, if you have anything in mind. Thanks :)

hons82 commented 8 years ago

Where did you try that? One of my samples? iOS version? Simulator?

zeeshankhan commented 8 years ago

I tried it on my application, running with iOS 9.2. Actually It's an issue of HMSegmentedControl class, which does not call UIControlEventValueChanged event. The only way I see is to manually add these files into my project and fix this thing. What do you say?

hons82 commented 8 years ago

In that case it would maybe make sense to fork the HMSegmentedControl and change it there + PR

zeeshankhan commented 8 years ago

Yeah, will do it. Once that get merged, will raise another PR here :)

hons82 commented 8 years ago

Thx... lets c if he's responding in a reasonable amount of time, otherwise, we'll have to create a custom version of HMSegmenetedControl, as I've done in the past too