Fixed #9 - Automatically update the Camels when Slider changes

This commit is contained in:
Xavier Schott 2015-03-12 15:27:06 -07:00
parent f01bb1e2be
commit 3af2a3fa4f
3 changed files with 16 additions and 4 deletions

View File

@ -294,8 +294,13 @@
#pragma mark - TGPControlsTicksProtocol
-(void)tgpTicksDistanceChanged:(CGFloat)ticksDistance sender:(id)sender
- (void)tgpTicksDistanceChanged:(CGFloat)ticksDistance sender:(id)sender
{
self.ticksDistance = ticksDistance;
}
- (void)tgpValueChanged:(unsigned int)value
{
self.value = value;
}
@end

View File

@ -29,6 +29,10 @@
// THE SOFTWARE.
@protocol TGPControlsTicksProtocol<NSObject>
@required
-(void)tgpTicksDistanceChanged:(CGFloat)ticksDistance sender:(id)sender;
- (void)tgpTicksDistanceChanged:(CGFloat)ticksDistance sender:(id)sender;
@optional
- (void)tgpValueChanged:(unsigned int)value;
@end

View File

@ -180,6 +180,11 @@ static CGSize iosThumbShadowOffset = (CGSize){0, 3};
}
- (void)sendActionsForControlEvents {
// Automatic UIControlEventValueChanged notification
if([self.ticksListener respondsToSelector:@selector(tgpValueChanged:)]) {
[self.ticksListener tgpValueChanged:self.value];
}
// Interface builder hides the IBInspectable for UIControl
#if !TARGET_INTERFACE_BUILDER
[self sendActionsForControlEvents:UIControlEventValueChanged];
@ -457,8 +462,6 @@ static CGSize iosThumbShadowOffset = (CGSize){0, 3};
- (CGSize)thumbSizeIncludingShadow {
switch (self.thumbStyle) {
case ComponentStyleInvisible:
return CGSizeZero;
case ComponentStyleRectangular:
case ComponentStyleRounded:
return ((self.thumbShadowRadius != 0.0)