Created
July 16, 2012 17:54
-
-
Save pita5/3124019 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation FCCDrawingView | |
- (void)setTransform:(CGAffineTransform)t | |
{ | |
[super setTransform:t]; | |
[self setNeedsDisplay]; | |
} | |
- (void)drawRect:(CGRect)rect | |
{ | |
[super drawRect:rect]; | |
NSLog(@"Re-drawing text content"); | |
CGContextRef ctx = UIGraphicsGetCurrentContext(); | |
CGAffineTransform ctm = CGContextGetCTM(ctx); | |
CGContextConcatCTM(ctx, CGAffineTransformIdentity); | |
NSLog(@"CTM Transform %@", NSStringFromCGAffineTransform(ctm)); | |
CGContextSaveGState(ctx); | |
CGAffineTransform t = self.transform; | |
NSLog(@"Views transform %@", NSStringFromCGAffineTransform(t)); | |
CGAffineTransform flip = CGAffineTransformMake(1.0f, | |
0.0f, | |
0.0f, | |
-1.0f, | |
0.0f, | |
rect.size.height); | |
NSLog(@"Flip transform %@", NSStringFromCGAffineTransform(flip)); | |
CGContextConcatCTM(ctx, flip); | |
CGAffineTransform ctm2 = CGContextGetCTM(ctx); | |
NSLog(@"CTM 2 Transform %@", NSStringFromCGAffineTransform(ctm2)); | |
if (_pageDrawingManager && ctx) | |
{ | |
CGPathRef path = CGPathCreateWithRect(rect, NULL); | |
CTFrameRef frame = CTFramesetterCreateFrame(_pageDrawingManager.framesetter, CFRangeMake(0, 0), path, NULL); | |
CFRelease(path); path = NULL; | |
if (frame) | |
{ | |
CTFrameDraw(frame, ctx); | |
CFRelease(frame); frame = NULL; | |
} | |
} | |
CGContextRestoreGState(ctx); | |
} | |
- initWithFrame:(CGRect)frame | |
{ | |
self = [super initWithFrame:frame]; | |
if (self) | |
{ | |
self.backgroundColor = [UIColor whiteColor]; | |
} | |
return self; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment