Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the ability to set an image for both handles #113

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Pod/Classes/TTRangeSlider.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ IB_DESIGNABLE
*/
@property (nonatomic, strong) UIImage *handleImage;

/**
* Handle slider with a custom image for both the right and left handles
*/
@property (nonatomic, strong) IBInspectable UIImage *rightHandleImage;
@property (nonatomic, strong) IBInspectable UIImage *leftHandleImage;

/**
*Handle slider with custom border color, you can set custom border color for your handle
Expand Down
24 changes: 24 additions & 0 deletions Pod/Classes/TTRangeSlider.m
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,30 @@ -(void)setHandleImage:(UIImage *)handleImage{
self.rightHandle.backgroundColor = [[UIColor clearColor] CGColor];
}

-(void)setRightHandleImage:(UIImage *)handleImage{
_rightHandleImage = handleImage;

CGRect startFrame = CGRectMake(0.0, 0.0, 31, 32);

self.rightHandle.contents = (id)handleImage.CGImage;
self.rightHandle.frame = startFrame;

//Force layer background to transparant
self.rightHandle.backgroundColor = [[UIColor clearColor] CGColor];
}

-(void)setLeftHandleImage:(UIImage *)handleImage{
_leftHandleImage = handleImage;

CGRect startFrame = CGRectMake(0.0, 0.0, 31, 32);

self.leftHandle.contents = (id)handleImage.CGImage;
self.leftHandle.frame = startFrame;

//Force layer background to transparant
self.leftHandle.backgroundColor = [[UIColor clearColor] CGColor];
}

-(void)setHandleColor:(UIColor *)handleColor{
_minHandleColor = handleColor;
_maxHandleColor = handleColor;
Expand Down