From c9a11518730ddacaf725aa71b54aaf080a7ad3ac Mon Sep 17 00:00:00 2001 From: Philip Messlehner Date: Mon, 22 Apr 2013 13:21:38 +0200 Subject: [PATCH 01/15] Added UIApperance-Selectors --- SVSegmentedControl/SVSegmentedControl.h | 26 ++++++++++++------------- SVSegmentedControl/SVSegmentedThumb.h | 16 +++++++-------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/SVSegmentedControl/SVSegmentedControl.h b/SVSegmentedControl/SVSegmentedControl.h index aea8a4b..d76dba3 100644 --- a/SVSegmentedControl/SVSegmentedControl.h +++ b/SVSegmentedControl/SVSegmentedControl.h @@ -29,19 +29,19 @@ @property (nonatomic, readwrite) CGFloat minimumOverlapToChange; // default is 0.66 - Only snap to a new segment if the thumb overlaps it by this fraction @property (nonatomic, readwrite) UIEdgeInsets touchTargetMargins; // default is UIEdgeInsetsMake(0, 0, 0, 0) - Enlarge touch target of control -@property (nonatomic, strong) UIColor *backgroundTintColor; // default is [UIColor colorWithWhite:0.1 alpha:1] -@property (nonatomic, strong) UIImage *backgroundImage; // default is nil - -@property (nonatomic, readwrite) CGFloat height; // default is 32.0 -@property (nonatomic, readwrite) UIEdgeInsets thumbEdgeInset; // default is UIEdgeInsetsMake(2, 2, 3, 2) -@property (nonatomic, readwrite) UIEdgeInsets titleEdgeInsets; // default is UIEdgeInsetsMake(0, 10, 0, 10) -@property (nonatomic, readwrite) CGFloat cornerRadius; // default is 4.0 - -@property (nonatomic, strong) UIFont *font; // default is [UIFont boldSystemFontOfSize:15] -@property (nonatomic, strong) UIColor *textColor; // default is [UIColor grayColor]; -@property (nonatomic, strong) UIColor *textShadowColor; // default is [UIColor blackColor] -@property (nonatomic, readwrite) CGSize textShadowOffset; // default is CGSizeMake(0, -1) -@property (nonatomic, strong) UIColor *innerShadowColor; // default is [UIColor colorWithWhite:0 alpha:0.8] +@property (nonatomic, strong) UIColor *backgroundTintColor UI_APPEARANCE_SELECTOR; // default is [UIColor colorWithWhite:0.1 alpha:1] +@property (nonatomic, strong) UIImage *backgroundImage UI_APPEARANCE_SELECTOR; // default is nil + +@property (nonatomic, readwrite) CGFloat height UI_APPEARANCE_SELECTOR; // default is 32.0 +@property (nonatomic, readwrite) UIEdgeInsets thumbEdgeInset UI_APPEARANCE_SELECTOR; // default is UIEdgeInsetsMake(2, 2, 3, 2) +@property (nonatomic, readwrite) UIEdgeInsets titleEdgeInsets UI_APPEARANCE_SELECTOR; // default is UIEdgeInsetsMake(0, 10, 0, 10) +@property (nonatomic, readwrite) CGFloat cornerRadius UI_APPEARANCE_SELECTOR; // default is 4.0 + +@property (nonatomic, strong) UIFont *font UI_APPEARANCE_SELECTOR; // default is [UIFont boldSystemFontOfSize:15] +@property (nonatomic, strong) UIColor *textColor UI_APPEARANCE_SELECTOR; // default is [UIColor grayColor]; +@property (nonatomic, strong) UIColor *textShadowColor UI_APPEARANCE_SELECTOR; // default is [UIColor blackColor] +@property (nonatomic, readwrite) CGSize textShadowOffset UI_APPEARANCE_SELECTOR; // default is CGSizeMake(0, -1) +@property (nonatomic, strong) UIColor *innerShadowColor UI_APPEARANCE_SELECTOR; // default is [UIColor colorWithWhite:0 alpha:0.8] - (SVSegmentedControl*)initWithSectionTitles:(NSArray*)titlesArray; - (void)setSelectedSegmentIndex:(NSUInteger)index animated:(BOOL)animated; diff --git a/SVSegmentedControl/SVSegmentedThumb.h b/SVSegmentedControl/SVSegmentedThumb.h index 8f4877a..9106d7a 100644 --- a/SVSegmentedControl/SVSegmentedThumb.h +++ b/SVSegmentedControl/SVSegmentedThumb.h @@ -14,14 +14,14 @@ @interface SVSegmentedThumb : UIView -@property (nonatomic, strong) UIImage *backgroundImage; // default is nil; -@property (nonatomic, strong) UIImage *highlightedBackgroundImage; // default is nil; +@property (nonatomic, strong) UIImage *backgroundImage UI_APPEARANCE_SELECTOR; // default is nil; +@property (nonatomic, strong) UIImage *highlightedBackgroundImage UI_APPEARANCE_SELECTOR; // default is nil; -@property (nonatomic, strong) UIColor *tintColor; // default is [UIColor grayColor] -@property (nonatomic, strong) UIColor *textColor; // default is [UIColor whiteColor] -@property (nonatomic, strong) UIColor *textShadowColor; // default is [UIColor blackColor] -@property (nonatomic, readwrite) CGSize textShadowOffset; // default is CGSizeMake(0, -1) -@property (nonatomic, readwrite) BOOL shouldCastShadow; // default is YES (NO when backgroundImage is set) -@property (nonatomic, assign) CGFloat gradientIntensity; // default is 0.15 +@property (nonatomic, strong) UIColor *tintColor UI_APPEARANCE_SELECTOR; // default is [UIColor grayColor] +@property (nonatomic, strong) UIColor *textColor UI_APPEARANCE_SELECTOR; // default is [UIColor whiteColor] +@property (nonatomic, strong) UIColor *textShadowColor UI_APPEARANCE_SELECTOR; // default is [UIColor blackColor] +@property (nonatomic, readwrite) CGSize textShadowOffset UI_APPEARANCE_SELECTOR; // default is CGSizeMake(0, -1) +@property (nonatomic, readwrite) BOOL shouldCastShadow UI_APPEARANCE_SELECTOR; // default is YES (NO when backgroundImage is set) +@property (nonatomic, assign) CGFloat gradientIntensity UI_APPEARANCE_SELECTOR; // default is 0.15 @end From 62942ce494a9964ae6f13160fc9ef3eaec58c801 Mon Sep 17 00:00:00 2001 From: Philip Messlehner Date: Wed, 24 Apr 2013 17:57:00 +0200 Subject: [PATCH 02/15] added StrokColorSupport and tried to introduced UIApperance, but not working --- SVSegmentedControl/SVSegmentedControl.h | 2 ++ SVSegmentedControl/SVSegmentedControl.m | 46 +++++++++++++++++++------ 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/SVSegmentedControl/SVSegmentedControl.h b/SVSegmentedControl/SVSegmentedControl.h index d76dba3..f24687c 100644 --- a/SVSegmentedControl/SVSegmentedControl.h +++ b/SVSegmentedControl/SVSegmentedControl.h @@ -32,6 +32,8 @@ @property (nonatomic, strong) UIColor *backgroundTintColor UI_APPEARANCE_SELECTOR; // default is [UIColor colorWithWhite:0.1 alpha:1] @property (nonatomic, strong) UIImage *backgroundImage UI_APPEARANCE_SELECTOR; // default is nil +@property (nonatomic, strong) UIColor *strokeColor UI_APPEARANCE_SELECTOR; // default is nil; + @property (nonatomic, readwrite) CGFloat height UI_APPEARANCE_SELECTOR; // default is 32.0 @property (nonatomic, readwrite) UIEdgeInsets thumbEdgeInset UI_APPEARANCE_SELECTOR; // default is UIEdgeInsetsMake(2, 2, 3, 2) @property (nonatomic, readwrite) UIEdgeInsets titleEdgeInsets UI_APPEARANCE_SELECTOR; // default is UIEdgeInsetsMake(0, 10, 0, 10) diff --git a/SVSegmentedControl/SVSegmentedControl.m b/SVSegmentedControl/SVSegmentedControl.m index ec82fae..8c1c4dd 100644 --- a/SVSegmentedControl/SVSegmentedControl.m +++ b/SVSegmentedControl/SVSegmentedControl.m @@ -76,19 +76,19 @@ - (id)initWithSectionTitles:(NSArray*)array { self.mustSlideToChange = NO; self.minimumOverlapToChange = 0.66; - self.font = [UIFont boldSystemFontOfSize:15]; - self.textColor = [UIColor grayColor]; - self.textShadowColor = [UIColor blackColor]; - self.textShadowOffset = CGSizeMake(0, -1); + _font = [UIFont boldSystemFontOfSize:15]; + _textColor = [UIColor grayColor]; + _textShadowColor = [UIColor blackColor]; + _textShadowOffset = CGSizeMake(0, -1); - self.titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 10); - self.thumbEdgeInset = UIEdgeInsetsMake(2, 2, 3, 2); - self.height = 32.0; - self.cornerRadius = 4.0; + _titleEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 10); + _thumbEdgeInset = UIEdgeInsetsMake(2, 2, 3, 2); + _height = 32.0; + _cornerRadius = 4.0; self.selectedSegmentIndex = 0; - self.innerShadowColor = [UIColor colorWithWhite:0 alpha:0.8]; + _innerShadowColor = [UIColor colorWithWhite:0 alpha:0.8]; [self setupAccessibility]; } @@ -523,8 +523,8 @@ - (void)drawRect:(CGRect)rect { bottomGlossPath.usesEvenOddFillRule = YES; [bottomGlossPath fill]; - CGPathRef roundedRect = [UIBezierPath bezierPathWithRoundedRect:insetRect cornerRadius:self.cornerRadius].CGPath; - CGContextAddPath(context, roundedRect); + UIBezierPath *roundedRectPath = [UIBezierPath bezierPathWithRoundedRect:insetRect cornerRadius:self.cornerRadius]; + CGContextAddPath(context, roundedRectPath.CGPath); CGContextClip(context); // background tint @@ -550,6 +550,13 @@ - (void)drawRect:(CGRect)rect { CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, components, NULL, 2); CGContextDrawLinearGradient(context, gradient, CGPointMake(0,0), CGPointMake(0,CGRectGetHeight(rect)-1), 0); CGGradientRelease(gradient); + + if (self.strokeColor) { + [self.strokeColor setStroke]; + roundedRectPath.lineWidth = 1.f; + [roundedRectPath stroke]; + } + CGColorSpaceRelease(colorSpace); // inner shadow @@ -685,4 +692,21 @@ - (void)drawInnerGlowWithPaths:(NSArray *)paths bounds:(CGRect)bounds color:(UIC } CGContextRestoreGState(gc); } +#pragma mark - Setters + +- (void)setFont:(UIFont *)font { + _font = font; + [self setNeedsDisplay]; +} + +- (void)setCornerRadius:(CGFloat)cornerRadius { + _cornerRadius = cornerRadius; + [self setNeedsLayout]; +} + +- (void)setHeight:(CGFloat)height { + _height = height; + [self setNeedsLayout]; +} + @end From 2e49b49e0afb1deea6b7396f146824ced12a048c Mon Sep 17 00:00:00 2001 From: Philip Messlehner Date: Thu, 23 May 2013 11:08:20 +0200 Subject: [PATCH 03/15] fixed an UI_APPEARENCE_ISSUE use ivars in initializer! --- SVSegmentedControl/SVSegmentedThumb.m | 36 +++++++++++++-------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/SVSegmentedControl/SVSegmentedThumb.m b/SVSegmentedControl/SVSegmentedThumb.m index ca494d1..ac5fc9d 100644 --- a/SVSegmentedControl/SVSegmentedThumb.m +++ b/SVSegmentedControl/SVSegmentedThumb.m @@ -35,7 +35,6 @@ - (void)deactivate; @implementation SVSegmentedThumb -@synthesize segmentedControl, backgroundImage, highlightedBackgroundImage, font, tintColor, textColor, textShadowColor, textShadowOffset, shouldCastShadow, selected; @synthesize firstLabel = _firstLabel; @synthesize secondLabel = _secondLabel; @synthesize firstImageView = _firstImageView; @@ -50,13 +49,12 @@ - (id)initWithFrame:(CGRect)frame { self.userInteractionEnabled = NO; self.clipsToBounds = YES; self.backgroundColor = [UIColor clearColor]; - self.textColor = [UIColor whiteColor]; - self.textShadowColor = [UIColor blackColor]; - self.textShadowOffset = CGSizeMake(0, -1); - self.tintColor = [UIColor grayColor]; - self.shouldCastShadow = YES; - self.backgroundColor = [UIColor clearColor]; - self.gradientIntensity = 0.15; + _textColor = [UIColor whiteColor]; + _textShadowColor = [UIColor blackColor]; + _textShadowOffset = CGSizeMake(0, -1); + _tintColor = [UIColor grayColor]; + _shouldCastShadow = YES; + _gradientIntensity = 0.15; } return self; @@ -299,11 +297,11 @@ - (void)arrangeLabel:(UILabel*)label imageView:(UIImageView*)imageView { - (void)setBackgroundImage:(UIImage *)newImage { - if(backgroundImage) - backgroundImage = nil; + if(_backgroundImage) + _backgroundImage = nil; if(newImage) { - backgroundImage = newImage; + _backgroundImage = newImage; self.shouldCastShadow = NO; } else { self.shouldCastShadow = YES; @@ -312,11 +310,11 @@ - (void)setBackgroundImage:(UIImage *)newImage { - (void)setTintColor:(UIColor *)newColor { - if(tintColor) - tintColor = nil; + if(_tintColor) + _tintColor = nil; if(newColor) - tintColor = newColor; + _tintColor = newColor; [self setNeedsDisplay]; } @@ -327,13 +325,13 @@ - (void)setFont:(UIFont *)newFont { } - (void)setTextColor:(UIColor *)newColor { - textColor = newColor; + _textColor = newColor; self.label.textColor = newColor; self.secondLabel.textColor = newColor; } - (void)setTextShadowColor:(UIColor *)newColor { - textShadowColor = newColor; + _textShadowColor = newColor; self.label.shadowColor = newColor; self.secondLabel.shadowColor = newColor; self.imageView.layer.shadowColor = newColor.CGColor; @@ -341,7 +339,7 @@ - (void)setTextShadowColor:(UIColor *)newColor { } - (void)setTextShadowOffset:(CGSize)newOffset { - textShadowOffset = newOffset; + _textShadowOffset = newOffset; self.label.shadowOffset = newOffset; self.secondLabel.shadowOffset = newOffset; self.imageView.layer.shadowOffset = newOffset; @@ -365,9 +363,9 @@ - (void)setFrame:(CGRect)newFrame { - (void)setSelected:(BOOL)s { - selected = s; + _selected = s; - if(selected && !self.segmentedControl.crossFadeLabelsOnDrag && !self.highlightedBackgroundImage) + if(_selected && !self.segmentedControl.crossFadeLabelsOnDrag && !self.highlightedBackgroundImage) self.alpha = 0.8; else self.alpha = 1; From 986176f4af473c0cff592e669d810eb26b0337f8 Mon Sep 17 00:00:00 2001 From: Philip Messlehner Date: Sat, 25 May 2013 18:43:11 +0200 Subject: [PATCH 04/15] reduced ShadowOffset --- SVSegmentedControl/SVSegmentedThumb.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SVSegmentedControl/SVSegmentedThumb.m b/SVSegmentedControl/SVSegmentedThumb.m index ac5fc9d..6edff93 100644 --- a/SVSegmentedControl/SVSegmentedThumb.m +++ b/SVSegmentedControl/SVSegmentedThumb.m @@ -107,6 +107,7 @@ - (UIImageView *)imageView { _firstImageView = [[UIImageView alloc] initWithFrame:CGRectZero]; _firstImageView.layer.shadowOpacity = 1; _firstImageView.layer.shadowRadius = 0; + _firstImageView.layer.shadowOffset = CGSizeMake(0,-1); [self addSubview:_firstImageView]; } return _firstImageView; @@ -117,6 +118,7 @@ - (UIImageView *)secondImageView { _secondImageView = [[UIImageView alloc] initWithFrame:CGRectZero]; _secondImageView.layer.shadowOpacity = 1; _secondImageView.layer.shadowRadius = 0; + _secondImageView.layer.shadowOffset = CGSizeMake(0,-1); [self addSubview:_secondImageView]; } return _secondImageView; From 363438502cf9c4523625db741f8da135e703045d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=A9=E8=BE=BA=E7=BE=85=E3=82=A8=E3=83=AB=E3=83=8D?= =?UTF-8?q?=E3=82=B9=E3=83=88?= Date: Thu, 31 Oct 2013 15:50:02 +0900 Subject: [PATCH 05/15] Make selectedSegmentIndex a publicly readwrite property To: * Better mimic a `UISegmentControl` (like #41 did for the property name). * Simpler syntax when no animation is desired. --- SVSegmentedControl/SVSegmentedControl.h | 2 +- SVSegmentedControl/SVSegmentedControl.m | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/SVSegmentedControl/SVSegmentedControl.h b/SVSegmentedControl/SVSegmentedControl.h index 2c6bf10..29c1fd4 100644 --- a/SVSegmentedControl/SVSegmentedControl.h +++ b/SVSegmentedControl/SVSegmentedControl.h @@ -21,7 +21,7 @@ @property (nonatomic, copy) NSArray *sectionImages; @property (nonatomic, strong, readonly) SVSegmentedThumb *thumb; -@property (nonatomic, readonly) NSUInteger selectedSegmentIndex; // default is 0 +@property (nonatomic, readwrite) NSUInteger selectedSegmentIndex; // default is 0 @property (nonatomic, readwrite) BOOL animateToInitialSelection; // default is NO @property (nonatomic, readwrite) BOOL crossFadeLabelsOnDrag; // default is NO diff --git a/SVSegmentedControl/SVSegmentedControl.m b/SVSegmentedControl/SVSegmentedControl.m index 4437107..28a1066 100644 --- a/SVSegmentedControl/SVSegmentedControl.m +++ b/SVSegmentedControl/SVSegmentedControl.m @@ -42,7 +42,6 @@ - (void)setupAccessibility; @property (nonatomic, strong) NSMutableArray *thumbRects; @property (nonatomic, strong) NSMutableArray *accessibilityElements; -@property (nonatomic, readwrite) NSUInteger selectedSegmentIndex; @property (nonatomic, readwrite) NSUInteger snapToIndex; @property (nonatomic, readwrite) BOOL trackingThumb; @property (nonatomic, readwrite) BOOL moved; From 0754413f75c90651d60930aed41d7efe75967b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=A9=E8=BE=BA=E7=BE=85=E3=82=A8=E3=83=AB=E3=83=8D?= =?UTF-8?q?=E3=82=B9=E3=83=88?= Date: Thu, 31 Oct 2013 18:00:47 +0900 Subject: [PATCH 06/15] Remove no longer used SVSegmentedControlDelegate --- SVSegmentedControl/SVSegmentedControl.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/SVSegmentedControl/SVSegmentedControl.h b/SVSegmentedControl/SVSegmentedControl.h index 2c6bf10..68e1a27 100644 --- a/SVSegmentedControl/SVSegmentedControl.h +++ b/SVSegmentedControl/SVSegmentedControl.h @@ -12,8 +12,6 @@ #import "SVSegmentedThumb.h" #import -@protocol SVSegmentedControlDelegate; - @interface SVSegmentedControl : UIControl @property (nonatomic, copy) void (^changeHandler)(NSUInteger newIndex); // you can also use addTarget:action:forControlEvents: @@ -54,9 +52,3 @@ @end - -@protocol SVSegmentedControlDelegate - -- (void)segmentedControl:(SVSegmentedControl*)segmentedControl didSelectIndex:(NSUInteger)index; - -@end From 2deb51bd5554743ca268deb047c312e7933cc09c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=A9=E8=BE=BA=E7=BE=85=E3=82=A8=E3=83=AB=E3=83=8D?= =?UTF-8?q?=E3=82=B9=E3=83=88?= Date: Thu, 31 Oct 2013 18:02:51 +0900 Subject: [PATCH 07/15] No need to keep Demo in podspec --- SVSegmentedControl.podspec | 1 - 1 file changed, 1 deletion(-) diff --git a/SVSegmentedControl.podspec b/SVSegmentedControl.podspec index 70e18d7..c0b2c22 100644 --- a/SVSegmentedControl.podspec +++ b/SVSegmentedControl.podspec @@ -10,6 +10,5 @@ Pod::Spec.new do |s| s.description = 'SVSegmentedControl is a customizable UIControl class that mimics UISegmentedControl but that looks like an UISwitch.' s.frameworks = 'QuartzCore' s.source_files = 'SVSegmentedControl/*.{h,m}' - s.preserve_paths = 'Demo' s.requires_arc = true end From e0ef436925819c74c20c9b15464aa797670a5eee Mon Sep 17 00:00:00 2001 From: lloydsheng Date: Wed, 19 Mar 2014 17:18:38 +0800 Subject: [PATCH 08/15] fix xcode 5.1 warning --- Demo/SVSegmentedControl.xcodeproj/project.pbxproj | 5 ++--- SVSegmentedControl/SVSegmentedControl.m | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Demo/SVSegmentedControl.xcodeproj/project.pbxproj b/Demo/SVSegmentedControl.xcodeproj/project.pbxproj index ea02dbc..1ec80e5 100755 --- a/Demo/SVSegmentedControl.xcodeproj/project.pbxproj +++ b/Demo/SVSegmentedControl.xcodeproj/project.pbxproj @@ -165,7 +165,7 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0450; + LastUpgradeCheck = 0510; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "SVSegmentedControl" */; compatibilityVersion = "Xcode 3.2"; @@ -254,11 +254,11 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; @@ -266,7 +266,6 @@ C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; diff --git a/SVSegmentedControl/SVSegmentedControl.m b/SVSegmentedControl/SVSegmentedControl.m index 4437107..a6fdad6 100644 --- a/SVSegmentedControl/SVSegmentedControl.m +++ b/SVSegmentedControl/SVSegmentedControl.m @@ -133,14 +133,14 @@ - (void)updateSectionRects { i = 0; self.thumbRects = [NSMutableArray new]; - for(NSString *titleString in self.sectionTitles) { + while (i < self.sectionTitles.count) { CGRect thumbRect = CGRectMake(self.segmentWidth*i, 0, self.segmentWidth, self.bounds.size.height); thumbRect.size.width+=10; // 5px drop shadow on each side thumbRect.origin.x-=5; thumbRect.size.height-=1; // for segmented bottom gloss [self.thumbRects addObject:[NSValue valueWithCGRect:thumbRect]]; i++; - } + } self.thumb.frame = [[self.thumbRects objectAtIndex:self.selectedSegmentIndex] CGRectValue]; self.thumb.layer.shadowPath = [UIBezierPath bezierPathWithRoundedRect:self.thumb.bounds cornerRadius:2].CGPath; From 090c7e5dc0ef83a4fa0c826cf808e621244db561 Mon Sep 17 00:00:00 2001 From: lloydsheng Date: Wed, 19 Mar 2014 17:27:20 +0800 Subject: [PATCH 09/15] fix xcode 5.1 warning --- SVSegmentedControl/SVSegmentedControl.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SVSegmentedControl/SVSegmentedControl.m b/SVSegmentedControl/SVSegmentedControl.m index a6fdad6..581c24e 100644 --- a/SVSegmentedControl/SVSegmentedControl.m +++ b/SVSegmentedControl/SVSegmentedControl.m @@ -613,7 +613,7 @@ - (void)drawRect:(CGRect)rect { [[self sectionImage:image withTintColor:self.textColor] drawAtPoint:CGPointMake(titlePosX, round((rect.size.height-image.size.height)/2))]; #if __IPHONE_OS_VERSION_MIN_REQUIRED < 60000 - [titleString drawAtPoint:CGPointMake(titlePosX+imageWidth, posY) forWidth:self.segmentWidth withFont:self.font lineBreakMode:UILineBreakModeTailTruncation]; + [titleString drawAtPoint:CGPointMake(titlePosX+imageWidth, posY) forWidth:self.segmentWidth withFont:self.font lineBreakMode:NSLineBreakByTruncatingTail]; #else [titleString drawAtPoint:CGPointMake(titlePosX+imageWidth, posY) forWidth:self.segmentWidth withFont:self.font lineBreakMode:NSLineBreakByClipping]; #endif @@ -653,7 +653,7 @@ - (UIImage *)maskWithPaths:(NSArray *)paths bounds:(CGRect)bounds // Create the bitmap with just an alpha channel. // When created, it has value 0 at every pixel. - CGContextRef gc = CGBitmapContextCreate(NULL, scaledSize.width, scaledSize.height, 8, scaledSize.width, NULL, kCGImageAlphaOnly); + CGContextRef gc = CGBitmapContextCreate(NULL, scaledSize.width, scaledSize.height, 8, scaledSize.width, NULL, kCGBitmapAlphaInfoMask); // Adjust the current transform matrix for the screen scale. CGContextScaleCTM(gc, scale, scale); From 811a064f7b2047eb33f5859f7db7a35ec9158da0 Mon Sep 17 00:00:00 2001 From: Philip Messlehner Date: Thu, 10 Apr 2014 11:48:58 +0200 Subject: [PATCH 10/15] should not use setter in initializer due to UIAppearance issues --- SVSegmentedControl/SVSegmentedControl.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SVSegmentedControl/SVSegmentedControl.m b/SVSegmentedControl/SVSegmentedControl.m index 8c1c4dd..941dd70 100644 --- a/SVSegmentedControl/SVSegmentedControl.m +++ b/SVSegmentedControl/SVSegmentedControl.m @@ -68,7 +68,7 @@ - (id)initWithSectionTitles:(NSArray*)array { self.accessibilityElements = [NSMutableArray arrayWithCapacity:self.sectionTitles.count]; self.backgroundColor = [UIColor clearColor]; - self.backgroundTintColor = [UIColor colorWithWhite:0 alpha:0.5]; + _backgroundTintColor = [UIColor colorWithWhite:0 alpha:0.5]; self.clipsToBounds = YES; self.userInteractionEnabled = YES; self.animateToInitialSelection = NO; From 3fd5f694321e8581e3ec824989baa1f79122a0c5 Mon Sep 17 00:00:00 2001 From: Philip Messlehner Date: Thu, 10 Apr 2014 12:03:57 +0200 Subject: [PATCH 11/15] fixed Warnings --- SVSegmentedControl/SVSegmentedControl.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SVSegmentedControl/SVSegmentedControl.m b/SVSegmentedControl/SVSegmentedControl.m index 941dd70..4f238e9 100644 --- a/SVSegmentedControl/SVSegmentedControl.m +++ b/SVSegmentedControl/SVSegmentedControl.m @@ -140,7 +140,7 @@ - (void)updateSectionRects { i = 0; self.thumbRects = [NSMutableArray new]; - for(NSString *titleString in self.sectionTitles) { + for(__unused NSString *titleString in self.sectionTitles) { CGRect thumbRect = CGRectMake(self.segmentWidth*i, 0, self.segmentWidth, self.bounds.size.height); thumbRect.size.width+=10; // 5px drop shadow on each side thumbRect.origin.x-=5; @@ -636,7 +636,7 @@ - (UIImage *)maskWithPaths:(NSArray *)paths bounds:(CGRect)bounds // Create the bitmap with just an alpha channel. // When created, it has value 0 at every pixel. - CGContextRef gc = CGBitmapContextCreate(NULL, scaledSize.width, scaledSize.height, 8, scaledSize.width, NULL, kCGImageAlphaOnly); + CGContextRef gc = CGBitmapContextCreate(NULL, scaledSize.width, scaledSize.height, 8, scaledSize.width, NULL, (UInt32)kCGImageAlphaOnly); // Adjust the current transform matrix for the screen scale. CGContextScaleCTM(gc, scale, scale); From 5509c8bcb94eb0e48ee80a506b7343b6d9cfcbea Mon Sep 17 00:00:00 2001 From: Daniel Blakemore Date: Thu, 5 Jun 2014 15:01:57 -0600 Subject: [PATCH 12/15] Added style presets for iOS 7, updated the demo project, and documented the header files with xcode doxygen-like comments --- Demo/1.png | Bin 0 -> 3322 bytes Demo/1@2x.png | Bin 0 -> 4076 bytes Demo/2.png | Bin 0 -> 3303 bytes Demo/2@2x.png | Bin 0 -> 3957 bytes Demo/3.png | Bin 0 -> 3399 bytes Demo/3@2x.png | Bin 0 -> 4196 bytes Demo/Classes/ViewController.m | 40 ++++- .../project.pbxproj | 24 +++ SVSegmentedControl/SVSegmentedControl.h | 162 ++++++++++++++++++ SVSegmentedControl/SVSegmentedControl.m | 90 ++++++++-- SVSegmentedControl/SVSegmentedThumb.h | 33 ++++ 11 files changed, 328 insertions(+), 21 deletions(-) create mode 100644 Demo/1.png create mode 100644 Demo/1@2x.png create mode 100644 Demo/2.png create mode 100644 Demo/2@2x.png create mode 100644 Demo/3.png create mode 100644 Demo/3@2x.png diff --git a/Demo/1.png b/Demo/1.png new file mode 100644 index 0000000000000000000000000000000000000000..b9d80af49a316878815f15a6841bc3a7194e79ff GIT binary patch literal 3322 zcmVX+uL$Nkc;* zP;zf(X>4Tx07wm;mUmQB*%pV-y*Itk5+Wca^cs2zAksTX6$DXM^`x7XQc?|s+0 z08spb1j2M!0f022SQPH-!CVp(%f$Br7!UytSOLJ{W@ZFO_(THK{JlMynW#v{v-a*T zfMmPdEWc1DbJqWVks>!kBnAKqMb$PuekK>?0+ds;#ThdH1j_W4DKdsJG8Ul;qO2n0 z#IJ1jr{*iW$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`Hh-Z(6xI-`hmHDqv!v)W&&nrf>M(RhcN6(D;jNN*%^u_SYjF;2ng}*8Ow)d6M ztDk;%`@Lsk$;9w$(d(H%O5UixIr`T2ZRcd@$Jp-`lxG+<}N*cP)0{uP4g;956_ileAF34((lg0wg)PAY{`F{DtOln9AFKi~3> zoV<7QX>{ z)c`v7R85FYz(bfzHYH}_`SzR!LD5+FI{A+{ZCHROQ1PNRCLR{&*6AmDjN;GmK+W(v)mK5{pWrCmh99tKg5DGF6mK@0%LET# z-B0vmax?G?cHo?H_~Wn(D{uzhf$WyA^<#3n+x6qJe8eRpH%<;41h(KTyrl3n{uSkKsJ%U`eH9-n4vg;=tjlcfAG^bp@$qr|}GIf`qiJ-n2^hVcPY`Ch7`P;>yvy z1iCO*p$26*Wp(kKe4^HbhN)$@TsKe6aH7_jM!`3?y!Rs$wWfoJk6d&R@v(_I@zkD= zUDS!&p6jZ#Kj?d34puy@M^NJb_g@(M&z>% literal 0 HcmV?d00001 diff --git a/Demo/1@2x.png b/Demo/1@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..ac64791ffb3d0acd7bb9614607a514464233770b GIT binary patch literal 4076 zcmVX+uL$Nkc;* zP;zf(X>4Tx07wm;mUmQB*%pV-y*Itk5+Wca^cs2zAksTX6$DXM^`x7XQc?|s+0 z08spb1j2M!0f022SQPH-!CVp(%f$Br7!UytSOLJ{W@ZFO_(THK{JlMynW#v{v-a*T zfMmPdEWc1DbJqWVks>!kBnAKqMb$PuekK>?0+ds;#ThdH1j_W4DKdsJG8Ul;qO2n0 z#IJ1jr{*iW$(WZWsE0n`c;fQ!l&-AnmjxZO1uWyz`0VP>&nP`#itsL#`S=Q!g`M=rU9)45( zJ;-|dRq-b5&z?byo>|{)?5r=n76A4nTALlSzLiw~v~31J<>9PP?;rs31pu_(obw)r zY+jPY;tVGXi|p)da{-@gE-UCa`=5eu%D;v=_nFJ?`&K)q7e9d`Nfk3?MdhZarb|T3 z%nS~f&t(1g5dY)AIcd$w!z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F-+zWa$|pg{~wggupbUU0saEj=_}qd=z1phSnqFKURs?3NMFwpi4kI zw;oPThKt~#N~NMx-)t`h<<(acJ%7t|CcFdn+Y;qSD;rrk2}4EGJ`KKrAlpXeU2q1} zckD)k6Em?`EY8P23Om7XCEn4sv+In~!$`7XZDJ%26+JXGq>V?Ll$loeLa0s5^2G7^ ze10e!CWA2Y)2bs!0F55$B5T uZLuca6RnSN;{QK?SWvHdgkCMu(Dg6gN+&Bo{AZ2;0000 +/** + * 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..d38e3f9 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); @@ -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 From ce12ac4ced264a3fe5d6803503b44c4379619bc2 Mon Sep 17 00:00:00 2001 From: Daniel Blakemore Date: Thu, 5 Jun 2014 20:02:19 -0600 Subject: [PATCH 13/15] missed one gradient --- SVSegmentedControl/SVSegmentedControl.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SVSegmentedControl/SVSegmentedControl.m b/SVSegmentedControl/SVSegmentedControl.m index d38e3f9..f679d12 100644 --- a/SVSegmentedControl/SVSegmentedControl.m +++ b/SVSegmentedControl/SVSegmentedControl.m @@ -617,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]]; From 3ffd45391da635f69daab73772e516cbd503e6e5 Mon Sep 17 00:00:00 2001 From: Joshua Nord Date: Tue, 24 Jun 2014 14:12:07 -0400 Subject: [PATCH 14/15] Fix 64-bit warnings (int) --- SVSegmentedControl/SVSegmentedControl.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SVSegmentedControl/SVSegmentedControl.m b/SVSegmentedControl/SVSegmentedControl.m index 4437107..9c4dd1f 100644 --- a/SVSegmentedControl/SVSegmentedControl.m +++ b/SVSegmentedControl/SVSegmentedControl.m @@ -112,8 +112,8 @@ - (void)sizeToFit - (void)updateSectionRects { - int c = [self.sectionTitles count]; - int i = 0; + NSUInteger c = [self.sectionTitles count]; + NSUInteger i = 0; [self calculateSegmentWidth]; @@ -133,7 +133,7 @@ - (void)updateSectionRects { i = 0; self.thumbRects = [NSMutableArray new]; - for(NSString *titleString in self.sectionTitles) { + for(NSString *titleString __unused in self.sectionTitles) { CGRect thumbRect = CGRectMake(self.segmentWidth*i, 0, self.segmentWidth, self.bounds.size.height); thumbRect.size.width+=10; // 5px drop shadow on each side thumbRect.origin.x-=5; @@ -365,7 +365,7 @@ - (void)snap:(BOOL)animated { self.thumb.secondImageView.alpha = 0; } - int index; + NSUInteger index; if(self.snapToIndex != -1) index = self.snapToIndex; From 8693373b62a8544850beadeffe303470a863be01 Mon Sep 17 00:00:00 2001 From: Ernesto Rivera Date: Tue, 11 Nov 2014 16:12:37 +0900 Subject: [PATCH 15/15] Fix warnings --- Demo/Classes/ViewController.m | 4 ++-- Demo/SVSegmentedControl.xcodeproj/project.pbxproj | 3 ++- SVSegmentedControl/SVSegmentedControl.m | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Demo/Classes/ViewController.m b/Demo/Classes/ViewController.m index 49ce9f0..62a6630 100644 --- a/Demo/Classes/ViewController.m +++ b/Demo/Classes/ViewController.m @@ -19,7 +19,7 @@ - (void)viewDidLoad { SVSegmentedControl *navSC = [[SVSegmentedControl alloc] initWithSectionTitles:[NSArray arrayWithObjects:@"Section 1", @"Section 2", nil]]; navSC.changeHandler = ^(NSUInteger newIndex) { - NSLog(@"segmentedControl did select index %i (via block handler)", newIndex); + NSLog(@"segmentedControl did select index %@ (via block handler)", @(newIndex)); }; [self.view addSubview:navSC]; @@ -109,7 +109,7 @@ - (void)viewDidLoad { #pragma mark - UIControlEventValueChanged - (void)segmentedControlChangedValue:(SVSegmentedControl*)segmentedControl { - NSLog(@"segmentedControl %i did select index %i (via UIControl method)", segmentedControl.tag, segmentedControl.selectedSegmentIndex); + NSLog(@"segmentedControl %@ did select index %@ (via UIControl method)", @(segmentedControl.tag), @(segmentedControl.selectedSegmentIndex)); } diff --git a/Demo/SVSegmentedControl.xcodeproj/project.pbxproj b/Demo/SVSegmentedControl.xcodeproj/project.pbxproj index 00be591..87a5ab6 100755 --- a/Demo/SVSegmentedControl.xcodeproj/project.pbxproj +++ b/Demo/SVSegmentedControl.xcodeproj/project.pbxproj @@ -253,7 +253,6 @@ GCC_PREFIX_HEADER = SVSegmentedControl_Prefix.pch; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "SVSegmentedControl-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 4.0; PRODUCT_NAME = SVSC; RUN_CLANG_STATIC_ANALYZER = YES; }; @@ -282,6 +281,7 @@ GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; @@ -294,6 +294,7 @@ GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 5.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; }; diff --git a/SVSegmentedControl/SVSegmentedControl.m b/SVSegmentedControl/SVSegmentedControl.m index 0e7a9c9..d50a81f 100644 --- a/SVSegmentedControl/SVSegmentedControl.m +++ b/SVSegmentedControl/SVSegmentedControl.m @@ -136,8 +136,8 @@ - (void)sizeToFit - (void)updateSectionRects { - int c = [self.sectionTitles count]; - int i = 0; + NSInteger c = [self.sectionTitles count]; + NSInteger i = 0; [self calculateSegmentWidth]; @@ -343,7 +343,7 @@ - (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event { if(!self.mustSlideToChange && !self.moved && self.trackingThumb && [self.sectionTitles count] == 2) [self toggle]; else if(!self.activated && posX > pMinX && posX < pMaxX) { - int potentialSnapToIndex = MIN(floor(cPos.x/self.segmentWidth), self.sectionTitles.count-1); + NSInteger potentialSnapToIndex = MIN(floor(cPos.x/self.segmentWidth), self.sectionTitles.count-1); if (self.mustSlideToChange) { CGRect potentialSegmentRect = CGRectMake(self.segmentWidth * potentialSnapToIndex, 0, self.segmentWidth, self.bounds.size.height); @@ -389,7 +389,7 @@ - (void)snap:(BOOL)animated { self.thumb.secondImageView.alpha = 0; } - int index; + NSInteger index; if(self.snapToIndex != -1) index = self.snapToIndex;