Skip to content

Instantly share code, notes, and snippets.

@leeprobert
Created March 15, 2013 13:08
Show Gist options
  • Save leeprobert/5169769 to your computer and use it in GitHub Desktop.
Save leeprobert/5169769 to your computer and use it in GitHub Desktop.
Simple UIView for drawing an embossed style horizontal line.
//
// HorizontalDivide.m
// iP2
//
// Created by Lee Probert on 25/01/2013.
//
//
#import "HorizontalDivide.h"
@implementation HorizontalDivide
- (void)drawRect:(CGRect)rect
{
//// center stroke
UIBezierPath* bezierPath = [UIBezierPath bezierPath];
[bezierPath moveToPoint: CGPointMake(0, 0)];
[bezierPath addLineToPoint: CGPointMake(rect.size.width, 0)];
[[UIColor lightGrayColor] setStroke];
bezierPath.lineWidth = 1;
[bezierPath stroke];
//// white highlight
UIBezierPath* bezier2Path = [UIBezierPath bezierPath];
[bezier2Path moveToPoint: CGPointMake(0, self.isConcave? 2 : -2)];
[bezier2Path addLineToPoint: CGPointMake(rect.size.width, self.isConcave? 1 : -1)];
[[UIColor whiteColor] setStroke];
bezier2Path.lineWidth = 1;
[bezier2Path stroke];
//// Black shadow
UIBezierPath* bezier3Path = [UIBezierPath bezierPath];
[bezier3Path moveToPoint: CGPointMake(0, self.isConcave? -2 : 2)];
[bezier3Path addLineToPoint: CGPointMake(rect.size.width, self.isConcave? -2 : 2)];
[[UIColor blackColor] setStroke];
bezier3Path.lineWidth = 1;
[bezier3Path stroke];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment