diff --git a/Demo/1.png b/Demo/1.png new file mode 100644 index 0000000..b9d80af Binary files /dev/null and b/Demo/1.png differ diff --git a/Demo/1@2x.png b/Demo/1@2x.png new file mode 100644 index 0000000..ac64791 Binary files /dev/null and b/Demo/1@2x.png differ diff --git a/Demo/2.png b/Demo/2.png new file mode 100644 index 0000000..3eef3f9 Binary files /dev/null and b/Demo/2.png differ diff --git a/Demo/2@2x.png b/Demo/2@2x.png new file mode 100644 index 0000000..df7f82d Binary files /dev/null and b/Demo/2@2x.png differ diff --git a/Demo/3.png b/Demo/3.png new file mode 100644 index 0000000..2f65526 Binary files /dev/null and b/Demo/3.png differ diff --git a/Demo/3@2x.png b/Demo/3@2x.png new file mode 100644 index 0000000..951a709 Binary files /dev/null and b/Demo/3@2x.png differ diff --git a/Demo/Classes/ViewController.m b/Demo/Classes/ViewController.m index e712d4b..49ce9f0 100644 --- a/Demo/Classes/ViewController.m +++ b/Demo/Classes/ViewController.m @@ -36,7 +36,7 @@ - (void)viewDidLoad { [self.view addSubview:redSC]; - redSC.center = CGPointMake(160, 170); + redSC.center = CGPointMake(160, 150); // 3rd CONTROL @@ -50,7 +50,7 @@ - (void)viewDidLoad { [self.view addSubview:grayRC]; - grayRC.center = CGPointMake(160, 270); + grayRC.center = CGPointMake(160, 230); // 4th CONTROL @@ -68,7 +68,41 @@ - (void)viewDidLoad { [self.view addSubview:yellowRC]; - yellowRC.center = CGPointMake(160, 370); + yellowRC.center = CGPointMake(160, 310); + + + // 4th CONTROL + SVSegmentedControl *imageRC = [[SVSegmentedControl alloc] initWithSectionTitles:[NSArray arrayWithObjects:@"Some", @"Section", @"Images", nil]]; + [imageRC setSectionImages:@[[UIImage imageNamed:@"1"], [UIImage imageNamed:@"2"], [UIImage imageNamed:@"3"], [UIImage imageNamed:@"3"]]]; + [imageRC addTarget:self action:@selector(segmentedControlChangedValue:) forControlEvents:UIControlEventValueChanged]; + imageRC.crossFadeLabelsOnDrag = YES; + imageRC.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 5); + imageRC.height = 40; + [imageRC setSelectedSegmentIndex:0 animated:NO]; + imageRC.thumb.tintColor = [UIColor colorWithRed:0.100 green:0.400 blue:0.800 alpha:1.000]; + imageRC.thumb.textColor = [UIColor whiteColor]; + imageRC.thumb.textColor = [UIColor whiteColor]; + imageRC.thumb.textShadowColor = [UIColor colorWithWhite:0 alpha:0.5]; + imageRC.thumb.textShadowOffset = CGSizeMake(0, 1); + + [self.view addSubview:imageRC]; + + imageRC.center = CGPointMake(160, 390); + + + // 5th CONTROL + SVSegmentedControl *iOS7FlatRC = [[SVSegmentedControl alloc] initWithSectionTitles:[NSArray arrayWithObjects:@"Can", @"Look", @"Flat", nil] stylePreset:SVSegmentedControlStylePresetFlat]; + [iOS7FlatRC addTarget:self action:@selector(segmentedControlChangedValue:) forControlEvents:UIControlEventValueChanged]; + iOS7FlatRC.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 5); + iOS7FlatRC.height = 40; + [iOS7FlatRC setSelectedSegmentIndex:1 animated:NO]; + iOS7FlatRC.thumb.tintColor = [UIColor colorWithRed:1.000 green:0.300 blue:0.100 alpha:1.000]; + iOS7FlatRC.thumb.textColor = [UIColor whiteColor]; + iOS7FlatRC.thumb.textColor = [UIColor whiteColor]; + + [self.view addSubview:iOS7FlatRC]; + + iOS7FlatRC.center = CGPointMake(160, 470); } diff --git a/Demo/SVSegmentedControl.xcodeproj/project.pbxproj b/Demo/SVSegmentedControl.xcodeproj/project.pbxproj index ea02dbc..3045a16 100755 --- a/Demo/SVSegmentedControl.xcodeproj/project.pbxproj +++ b/Demo/SVSegmentedControl.xcodeproj/project.pbxproj @@ -21,6 +21,12 @@ 2899E5220DE3E06400AC0155 /* ViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* ViewController.xib */; }; 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; 28D7ACF80DDB3853001CB0EB /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* ViewController.m */; }; + 651F8D091940E22A00345FC0 /* 1.png in Resources */ = {isa = PBXBuildFile; fileRef = 651F8D031940E22A00345FC0 /* 1.png */; }; + 651F8D0A1940E22A00345FC0 /* 1@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 651F8D041940E22A00345FC0 /* 1@2x.png */; }; + 651F8D0B1940E22A00345FC0 /* 2.png in Resources */ = {isa = PBXBuildFile; fileRef = 651F8D051940E22A00345FC0 /* 2.png */; }; + 651F8D0C1940E22A00345FC0 /* 2@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 651F8D061940E22A00345FC0 /* 2@2x.png */; }; + 651F8D0D1940E22A00345FC0 /* 3.png in Resources */ = {isa = PBXBuildFile; fileRef = 651F8D071940E22A00345FC0 /* 3.png */; }; + 651F8D0E1940E22A00345FC0 /* 3@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 651F8D081940E22A00345FC0 /* 3@2x.png */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -44,6 +50,12 @@ 28D7ACF70DDB3853001CB0EB /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* SVSegmentedControl_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVSegmentedControl_Prefix.pch; sourceTree = ""; }; + 651F8D031940E22A00345FC0 /* 1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = 1.png; sourceTree = ""; }; + 651F8D041940E22A00345FC0 /* 1@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "1@2x.png"; sourceTree = ""; }; + 651F8D051940E22A00345FC0 /* 2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = 2.png; sourceTree = ""; }; + 651F8D061940E22A00345FC0 /* 2@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "2@2x.png"; sourceTree = ""; }; + 651F8D071940E22A00345FC0 /* 3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = 3.png; sourceTree = ""; }; + 651F8D081940E22A00345FC0 /* 3@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "3@2x.png"; sourceTree = ""; }; 8D1107310486CEB800E47090 /* SVSegmentedControl-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "SVSegmentedControl-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -124,6 +136,12 @@ children = ( 28AD733E0D9D9553002E5188 /* MainWindow.xib */, 8D1107310486CEB800E47090 /* SVSegmentedControl-Info.plist */, + 651F8D031940E22A00345FC0 /* 1.png */, + 651F8D041940E22A00345FC0 /* 1@2x.png */, + 651F8D051940E22A00345FC0 /* 2.png */, + 651F8D061940E22A00345FC0 /* 2@2x.png */, + 651F8D071940E22A00345FC0 /* 3.png */, + 651F8D081940E22A00345FC0 /* 3@2x.png */, ); name = Resources; sourceTree = ""; @@ -191,9 +209,15 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 651F8D0A1940E22A00345FC0 /* 1@2x.png in Resources */, + 651F8D0E1940E22A00345FC0 /* 3@2x.png in Resources */, + 651F8D0B1940E22A00345FC0 /* 2.png in Resources */, + 651F8D0D1940E22A00345FC0 /* 3.png in Resources */, + 651F8D091940E22A00345FC0 /* 1.png in Resources */, 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, 2899E5220DE3E06400AC0155 /* ViewController.xib in Resources */, 224B1756145F25D600BD2DDB /* README.md in Resources */, + 651F8D0C1940E22A00345FC0 /* 2@2x.png in Resources */, 22A748901630AD4E004893A8 /* Default-568h@2x.png in Resources */, 223F841D16BC891900C3C219 /* SVSegmentedControl.podspec in Resources */, ); diff --git a/SVSegmentedControl/SVSegmentedControl.h b/SVSegmentedControl/SVSegmentedControl.h index 2c6bf10..0d2401d 100644 --- a/SVSegmentedControl/SVSegmentedControl.h +++ b/SVSegmentedControl/SVSegmentedControl.h @@ -12,38 +12,200 @@ #import "SVSegmentedThumb.h" #import +/** + * Default initial styles to enable or disable multiple visual attributes at once. + */ +typedef NS_ENUM(NSInteger, SVSegmentedControlStylePreset) +{ + /** + * The default style used when nothing is set. Shadows and gradient are intact. + */ + SVSegmentedControlStylePresetDefault, + /** + * A flat style to match iOS 7+ style layouts. All shadows and gradient disabled. + */ + SVSegmentedControlStylePresetFlat, +}; + @protocol SVSegmentedControlDelegate; +/** + * SVSegmentedControl is a customizable UIControl class that mimics UISegmentedControl but that looks like an UISwitch. + * In its simplest form, this is how you create an SVSegmentedControl instance: + * @code + segmentedControl = [[SVSegmentedControl alloc] initWithSectionTitles:[NSArray arrayWithObjects:@"Section 1", @"Section 2", nil]]; + segmentedControl.changeHandler = ^(NSUInteger newIndex) { + // respond to index change + }; + + [self.view addSubview:segmentedControl]; + * @endcode + * You can position it using either its frame or center property: + */ @interface SVSegmentedControl : UIControl +/** + * A block called whenever there is a change to the switch. + * If you haven't fallen in love with blocks yet, you can still use the classic UIControl method: + * @code +[mySegmentedControl addTarget:self action:@selector(segmentedControlChangedValue:) forControlEvents:UIControlEventValueChanged]; + * @endcode + * + * Providing an action method ending with a semicolon, the sender object is therefore made accessible: + * @code +- (void)segmentedControlChangedValue:(SVSegmentedControl*)segmentedControl { + NSLog(@"segmentedControl did select index %i", segmentedControl.selectedIndex); +} + * @endcode + */ @property (nonatomic, copy) void (^changeHandler)(NSUInteger newIndex); // you can also use addTarget:action:forControlEvents: + +/** + * The titles for each section of the switch. These are laid out in the order specicied in the array. + */ @property (nonatomic, copy) NSArray *sectionTitles; + +/** + * Images placed to the left of section titles. Images are assigned to titles with corresponding indices. + * If not enough images are provided, the remaining section(s) will be displayed normally. + * If too many images are provided, the remaining images are not displayed. + */ @property (nonatomic, copy) NSArray *sectionImages; +/** + * The thumb that moves to the selected section. Access this property to change its appearance. + */ @property (nonatomic, strong, readonly) SVSegmentedThumb *thumb; + +/** + * The currently selected index of the switch. The default value is 0. + */ @property (nonatomic, readonly) NSUInteger selectedSegmentIndex; // default is 0 + +/** + * Whether or not to animated the change to initial selection. The default value is NO. + * @remarks This doesn't seem to be used anywhere. + */ @property (nonatomic, readwrite) BOOL animateToInitialSelection; // default is NO + +/** + * Whether or not to change the title on the thumb, or slide the thumb over the titles. + * If set to NO (the default) the thumb moves while the old and new titles stay lined up with the titles + * in the background, sliding on and off the thumb. + * If set to YES, as the thumb moves, the title stays in place and fades between the two sections. + */ @property (nonatomic, readwrite) BOOL crossFadeLabelsOnDrag; // default is NO +/** + * Whether the switch must be changed with a pan gesture to make the control difficult to accidentally change. + * The default is NO. + */ @property (nonatomic, readwrite) BOOL mustSlideToChange; // default is NO - To make the control difficult to accidentally change, force the user to slide it + +/** + * The fractional amount by which the thumb must overlap a destination segment to cause a snap to that segment. + * The default value is 0.66. + */ @property (nonatomic, readwrite) CGFloat minimumOverlapToChange; // default is 0.66 - Only snap to a new segment if the thumb overlaps it by this fraction + +/** + * Margins to add to the touchable area of the control. + * The default is UIEdgeInsetsMake(0, 0, 0, 0). + */ @property (nonatomic, readwrite) UIEdgeInsets touchTargetMargins; // default is UIEdgeInsetsMake(0, 0, 0, 0) - Enlarge touch target of control +/** + * The color used in the background of the switch. + * The default is [UIColor colorWithWhite:0.1 alpha:1]. + */ @property (nonatomic, strong) UIColor *backgroundTintColor; // default is [UIColor colorWithWhite:0.1 alpha:1] + +/** + * The image used in the background of the switch. + * The default is nil. + */ @property (nonatomic, strong) UIImage *backgroundImage; // default is nil +/** + * The height of the control. The default is 32.0. + */ @property (nonatomic, readwrite) CGFloat height; // default is 32.0 + +/** + * The insets of the thumb from the boundries of the segment and the control. + * The default is UIEdgeInsetsMake(2, 2, 3, 2). + */ @property (nonatomic, readwrite) UIEdgeInsets thumbEdgeInset; // default is UIEdgeInsetsMake(2, 2, 3, 2) + +/** + * The insets from the edge of the control to the edges of the segment titles. + * The default is UIEdgeInsetsMake(0, 10, 0, 10). + */ @property (nonatomic, readwrite) UIEdgeInsets titleEdgeInsets; // default is UIEdgeInsetsMake(0, 10, 0, 10) + +/** + * The corner radius of the control. The default is 4.0. + */ @property (nonatomic, readwrite) CGFloat cornerRadius; // default is 4.0 +/** + * The font used for the titles. The default is [UIFont boldSystemFontOfSize:15]. + */ @property (nonatomic, strong) UIFont *font; // default is [UIFont boldSystemFontOfSize:15] + +/** + * The color of the text in the segments that are not selected. The default is [UIColor grayColor]. + */ @property (nonatomic, strong) UIColor *textColor; // default is [UIColor grayColor]; + +/** + * The color of the shadow for the text in the segments that are not selected. The default is [UIColor blackColor]. + */ @property (nonatomic, strong) UIColor *textShadowColor; // default is [UIColor blackColor] + +/** + * The offset of the shadow from the text in the segments that are not selected. The default is CGSizeMake(0, -1). + */ @property (nonatomic, readwrite) CGSize textShadowOffset; // default is CGSizeMake(0, -1) + +/** + * The color of the shadow inside the control along the edges. The default is [UIColor colorWithWhite:0 alpha:0.8]. + */ @property (nonatomic, strong) UIColor *innerShadowColor; // default is [UIColor colorWithWhite:0 alpha:0.8] +/** + * The preset style. Setting this will change all documented shadow colors, the thumb gradient, + * and remove the bottom gloss. The default value is SVSegmentedControlStylePresetDefault. + */ +@property (nonatomic, readwrite) SVSegmentedControlStylePreset stylePreset; + +/** + * Make a new segmented control with the specified section titles. + * Initialized with SVSegmentedControlStylePresetDefault. + * + * @param titlesArray an array of section titles for the new control + * + * @return a new segemented control with the specified titles + */ - (SVSegmentedControl*)initWithSectionTitles:(NSArray*)titlesArray; + +/** + * Make a new segmented control with the specified section titles and style. + * + * + * @param titlesArray an array of section titles for the new control + * @param style the initial styling preset for the control + * + * @return a new segmented control with the specified titles and style preset + */ +- (SVSegmentedControl*)initWithSectionTitles:(NSArray*)titlesArray stylePreset:(SVSegmentedControlStylePreset)stylePreset; + +/** + * Selects a specified index in the control. Either animates or jumps straight to the new state. + * + * @param index the new index to select + * @param animated whether to animate the change in selection + */ - (void)setSelectedSegmentIndex:(NSUInteger)index animated:(BOOL)animated; // deprecated diff --git a/SVSegmentedControl/SVSegmentedControl.m b/SVSegmentedControl/SVSegmentedControl.m index 4437107..f679d12 100644 --- a/SVSegmentedControl/SVSegmentedControl.m +++ b/SVSegmentedControl/SVSegmentedControl.m @@ -96,6 +96,31 @@ - (id)initWithSectionTitles:(NSArray*)array { return self; } +- (SVSegmentedControl*)initWithSectionTitles:(NSArray*)titlesArray stylePreset:(SVSegmentedControlStylePreset)stylePreset +{ + if (self = [self initWithSectionTitles:titlesArray]) { + _stylePreset = stylePreset; + + switch (_stylePreset) { + case SVSegmentedControlStylePresetFlat: + // remove shadows and gradient + self.textShadowColor = [UIColor clearColor]; + self.innerShadowColor = [UIColor clearColor]; + self.thumb.textShadowColor = [UIColor clearColor]; + self.thumb.shouldCastShadow = FALSE; + self.thumb.gradientIntensity = 0.0f; + break; + + case SVSegmentedControlStylePresetDefault: + default: + // do nothing + break; + } + } + + return self; +} + - (SVSegmentedThumb *)thumb { if(_thumb == nil) @@ -513,6 +538,32 @@ - (void)setThumbSecondValuesForIndex:(NSUInteger)index { image:[self sectionImage:[self imageForSectionIndex:index] withTintColor:self.thumb.textColor]]; } +- (void)setStylePreset:(SVSegmentedControlStylePreset)stylePreset +{ + _stylePreset = stylePreset; + + switch (_stylePreset) { + case SVSegmentedControlStylePresetFlat: + // remove shadows and gradient + self.textShadowColor = [UIColor clearColor]; + self.innerShadowColor = [UIColor clearColor]; + self.thumb.textShadowColor = [UIColor clearColor]; + self.thumb.shouldCastShadow = FALSE; + self.thumb.gradientIntensity = 0.0f; + break; + + case SVSegmentedControlStylePresetDefault: + default: + // do nothing + self.textShadowColor = [UIColor blackColor]; + self.innerShadowColor = [UIColor colorWithWhite:0 alpha:0.8]; + self.thumb.textShadowColor = [UIColor blackColor]; + self.thumb.shouldCastShadow = !!_backgroundImage; + self.thumb.gradientIntensity = 0.15f; + break; + } +} + #pragma mark - Deprecated methods - (void)setSelectedIndex:(NSUInteger)index { @@ -534,18 +585,19 @@ - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); - if(self.backgroundImage) + if(self.backgroundImage) { [self.backgroundImage drawInRect:rect]; - - else { - // bottom gloss - CGRect insetRect = CGRectMake(0, 0, rect.size.width, rect.size.height-1); - CGContextSetFillColorWithColor(context, [UIColor colorWithWhite:1 alpha:0.1].CGColor); - - UIBezierPath *bottomGlossPath = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:self.cornerRadius]; - [bottomGlossPath appendPath:[UIBezierPath bezierPathWithRoundedRect:insetRect cornerRadius:self.cornerRadius]]; - bottomGlossPath.usesEvenOddFillRule = YES; - [bottomGlossPath fill]; + } else { + CGRect insetRect = CGRectMake(0, 0, rect.size.width, rect.size.height-1);; + if (_stylePreset == SVSegmentedControlStylePresetDefault) { + // bottom gloss + CGContextSetFillColorWithColor(context, [UIColor colorWithWhite:1 alpha:0.1].CGColor); + + UIBezierPath *bottomGlossPath = [UIBezierPath bezierPathWithRoundedRect:rect cornerRadius:self.cornerRadius]; + [bottomGlossPath appendPath:[UIBezierPath bezierPathWithRoundedRect:insetRect cornerRadius:self.cornerRadius]]; + bottomGlossPath.usesEvenOddFillRule = YES; + [bottomGlossPath fill]; + } CGPathRef roundedRect = [UIBezierPath bezierPathWithRoundedRect:insetRect cornerRadius:self.cornerRadius].CGPath; CGContextAddPath(context, roundedRect); @@ -565,7 +617,7 @@ - (void)drawRect:(CGRect)rect { CGFloat tintColorRGBA[4]; [tintColorToApply getRed:&tintColorRGBA[0] green:&tintColorRGBA[1] blue:&tintColorRGBA[2] alpha:&tintColorRGBA[3]]; - float darkeningDelta = 0.2; + float darkeningDelta = (_stylePreset == SVSegmentedControlStylePresetDefault) ? 0.2 : 0; // no gradient on flat UIColor *darkerTintColor = [UIColor colorWithRed:(tintColorRGBA[0] - darkeningDelta) green:(tintColorRGBA[1] - darkeningDelta) blue:(tintColorRGBA[2] - darkeningDelta) alpha:(tintColorRGBA[3] + darkeningDelta*0.2)]; CGFloat darkerTintColorRGBA[4]; [darkerTintColor getRed:&darkerTintColorRGBA[0] green:&darkerTintColorRGBA[1] blue:&darkerTintColorRGBA[2] alpha:&darkerTintColorRGBA[3]]; @@ -576,13 +628,15 @@ - (void)drawRect:(CGRect)rect { CGGradientRelease(gradient); CGColorSpaceRelease(colorSpace); - // inner shadow - NSArray *paths = [NSArray arrayWithObject:[UIBezierPath bezierPathWithRoundedRect:insetRect cornerRadius:self.cornerRadius]]; - UIImage *mask = [self maskWithPaths:paths bounds:CGRectInset(insetRect, -10, -10)]; - UIImage *invertedImage = [self invertedImageWithMask:mask color:self.innerShadowColor]; - - CGContextSetShadowWithColor(context, CGSizeMake(0, 1), 2, self.innerShadowColor.CGColor); - [invertedImage drawAtPoint:CGPointMake(-10, -10)]; + if (_stylePreset == SVSegmentedControlStylePresetDefault) { + // inner shadow + NSArray *paths = [NSArray arrayWithObject:[UIBezierPath bezierPathWithRoundedRect:insetRect cornerRadius:self.cornerRadius]]; + UIImage *mask = [self maskWithPaths:paths bounds:CGRectInset(insetRect, -10, -10)]; + UIImage *invertedImage = [self invertedImageWithMask:mask color:self.innerShadowColor]; + + CGContextSetShadowWithColor(context, CGSizeMake(0, 1), 2, self.innerShadowColor.CGColor); + [invertedImage drawAtPoint:CGPointMake(-10, -10)]; + } } diff --git a/SVSegmentedControl/SVSegmentedThumb.h b/SVSegmentedControl/SVSegmentedThumb.h index 8f4877a..af488bd 100644 --- a/SVSegmentedControl/SVSegmentedThumb.h +++ b/SVSegmentedControl/SVSegmentedThumb.h @@ -14,14 +14,47 @@ @interface SVSegmentedThumb : UIView +/** + * The image to use in the background of the thumb. The default is nil. + * Setting this property, sets the valye of shouldCastShadow to NO. + */ @property (nonatomic, strong) UIImage *backgroundImage; // default is nil; + +/** + * The image used in the background when highlighted. The default is nil. + */ @property (nonatomic, strong) UIImage *highlightedBackgroundImage; // default is nil; +/** + * The color of the thumb used as a base for the gradient. The default is [UIColor grayColor]. + */ @property (nonatomic, strong) UIColor *tintColor; // default is [UIColor grayColor] + +/** + * The color the title text in the thumb. The default is [UIColor whiteColor]. + */ @property (nonatomic, strong) UIColor *textColor; // default is [UIColor whiteColor] + +/** + * The color of the shadow for the title text in the thumb. The default is [UIColor blackColor]. + */ @property (nonatomic, strong) UIColor *textShadowColor; // default is [UIColor blackColor] + +/** + * The offset of the shadow from the title text in the thumb. The default is CGSizeMake(0, -1). + */ @property (nonatomic, readwrite) CGSize textShadowOffset; // default is CGSizeMake(0, -1) + +/** + * Whether or not the thumb should cast a shadow on the rest of the control. The default is YES. + * This value is set to NO if the backgroundImage property is set to something other than nil. + */ @property (nonatomic, readwrite) BOOL shouldCastShadow; // default is YES (NO when backgroundImage is set) + +/** + * How much darker to make the second color in the gradient. Valid values range from 0 (no gradient) + * to 1 (gradient from tintColor to black). The default is 0.15. + */ @property (nonatomic, assign) CGFloat gradientIntensity; // default is 0.15 @end