Skip to content

Instantly share code, notes, and snippets.

@vitalybaev
Forked from cemolcay/ASDisplayNodeDraw
Created October 1, 2015 15:54
Show Gist options
  • Save vitalybaev/a3af0f4f784375619f4c to your computer and use it in GitHub Desktop.
Save vitalybaev/a3af0f4f784375619f4c to your computer and use it in GitHub Desktop.
ASDisplayNode draw shadow & border
override class func drawRect(
bounds: CGRect,
withParameters parameters: NSObjectProtocol!,
isCancelled isCancelledBlock: asdisplaynode_iscancelled_block_t!,
isRasterizing: Bool) {
let context = UIGraphicsGetCurrentContext()
CGContextSaveGState(context)
CGContextSetShadowWithColor(context, CGSize (width: 0, height: 1), 10, UIColor.TitleColor().CGColor)
super.drawRect(
bounds,
withParameters: parameters,
isCancelled: isCancelledBlock,
isRasterizing: isRasterizing)
let path = UIBezierPath (roundedRect: bounds, cornerRadius: 5)
UIColor.redColor().setStroke()
path.stroke()
CGContextRestoreGState(context)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment