TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Marc Hervera.
Category for drawing on UIView with a simplest way
Import
#import "UIView+DrawBlock.h"
Use it! Result block returns a UIView added to original view with the drawing.
[viewToDraw drawInside:^(CGContextRef context, CGRect rect) {
// Draw
CGContextSetStrokeColorWithColor(context, [UIColor redColor].CGColor);
CGContextSetLineWidth(context, 5.0);
CGContextBeginPath(context);
CGContextMoveToPoint(context, 0.0, 0.0);
CGContextAddLineToPoint(context, 100.0, 100.0);
CGContextStrokePath(context);
} withResult:^(UIView *view) {
// Do what you want!
}];
Requires Xcode 5, targeting either iOS 6.0 and above