6.6 Unsere Zeichnung als PDF speichern

Ziehen wir den Inhalt der Methode drawRect: heraus, damit wir die Befehle, mit denen wir auf den Bildschirm zeichnen, nutzen können, um ein PDF des Bilds zu erstellen:

Drawing/Bezier11/Classes/BezierView.m

-(void) drawInCurrentContext {
    UIBezierPath *triangle = [[self triangle] retain];
    [self centerPath: triangle];
    [self fill:triangle withColor:[UIColor yellowColor]];
    [self stroke:triangle withColor:[UIColor blackColor] width:20.0];
    UIBezierPath *exclamationPoint = [[self exclamationPoint] retain];
    [self centerPath:exclamationPoint];
    [self fill:exclamationPoint withColor:[UIColor blackColor]];
    [exclamationPoint release];
    [triangle release];
}
-(void)drawRect:(CGRect)rect {
    [self drawInCurrentContext];
}

Wenn ...

Get iPad-Programmierung now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.