def CGContextSaveRestoreGState(&blk) context = UIGraphicsGetCurrentContext CGContextSaveGState(context) blk[context] CGContextRestoreGState(context)
end
CGContextSaveRestoreGState do |context| line_path = CGPathCreateMutable() line_pathY = 10.0 CGPathMoveToPoint(linePath, nil, 1.0, line_pathY) CGPathAddLineToPoint(line_path, nil, self.bounds.size.width, line_pathY) CGContextAddPath(context, line_path)
CGPathRelease(line_path)
CGContextSetLineWidth(context, 1.0) CGContextSetStrokeColorWithColor(context, :black.uicolor(0.6).CGColor) CGContextSetShadowWithColor(context, CGSizeMake(0.0, 1.0), 0.0, :white.u
CGContextDrawPath(context, KCGPathStroke)
end
It feels more naturally for me :-), I think people writing Cocoa-/Touch Wrappers should really understand what they're doing, I've seen some really big Problems with Rubymotion Libs that are using to much memory because people don't reuse cell and overusing the Main queue/thread.
BR,
Mateus
--