Permalink
Browse files

Merge pull request #5 from mz2/master

Make the tab bar background drawing and border drawing optional
  • Loading branch information...
2 parents 57f84e3 + 64f32d6 commit 0146f4b59b3aff457a9dd5a6c24743595c150bd6 @malcommac committed Feb 15, 2013
Showing with 16 additions and 6 deletions.
  1. +3 −0 .gitignore
  2. +13 −6 DMTabBar/DMTabBar/DMTabBar.m
View
@@ -0,0 +1,3 @@
+DMTabBar/DMTabBar.xcodeproj/project.xcworkspace/xcuserdata/mz2.xcuserdatad/UserInterfaceState.xcuserstate
+DMTabBar/DMTabBar.xcodeproj/xcuserdata/mz2.xcuserdatad/xcschemes/xcschememanagement.plist
+DMTabBar/DMTabBar.xcodeproj/xcuserdata/mz2.xcuserdatad/xcschemes/DMTabBar.xcscheme
@@ -68,14 +68,21 @@ - (void)setDefaultColors
}
- (void)drawRect:(NSRect)dirtyRect {
- // Draw bar gradient
- [[[NSGradient alloc] initWithStartingColor:self.gradientColorStart endingColor:self.gradientColorEnd] drawInRect:self.bounds angle:90.0];
+
+ // Draw bar gradient if its color is set
+ if (_gradientColorStart && _gradientColorEnd)
+ {
+ [[[NSGradient alloc] initWithStartingColor:self.gradientColorStart endingColor:self.gradientColorEnd] drawInRect:self.bounds angle:90.0];
+ }
// Draw drak gray bottom border
- [_borderColor setStroke];
- [NSBezierPath setDefaultLineWidth:0.0f];
- [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMinX(self.bounds), NSMaxY(self.bounds))
- toPoint:NSMakePoint(NSMaxX(self.bounds), NSMaxY(self.bounds))];
+ if (_borderColor)
+ {
+ [_borderColor setStroke];
+ [NSBezierPath setDefaultLineWidth:0.0f];
+ [NSBezierPath strokeLineFromPoint:NSMakePoint(NSMinX(self.bounds), NSMaxY(self.bounds))
+ toPoint:NSMakePoint(NSMaxX(self.bounds), NSMaxY(self.bounds))];
+ }
}
- (BOOL) isFlipped {

0 comments on commit 0146f4b

Please sign in to comment.