2013-08-06 11 views
15

Następujące elementy będą uznawane za wycofane w systemie iOS 7: CGContextSelectFont, CGContextShowTextAtPoint. Co powinienem zamiast tego użyć?CGContextShowTextAtPoint przestarzałe - co mam teraz użyć?

+2

Wszystkie zmiany interfejsu API systemu iOS w wersji beta są objęte NDA i nie można ich tutaj omawiać. To jest coś dla forów programistów Apple. –

Odpowiedz

9

Można użyć [yourString drawAtPoint:aPoint withAttributes:dictOfAttributes];

Dokumenty dla tego here.

Albo możesz po prostu dodać UILabel do hierarchii widoków.

2

// Rozpocznij kontekst graficzny UIGraphicsBeginImageContext (imageSize);

//get the context for coreGraphics 
CGContextRef ctx = UIGraphicsGetCurrentContext(); 

CGContextSetTextDrawingMode(ctx, kCGTextFill); 
[[UIColor blackColor] setFill]; 
[@"yourstring" drawAtPoint:CGPointMake(0, 0) withAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"Helvetica" size:17]}]; 
//make image out of bitmap context 
UIImage *outputImage = UIGraphicsGetImageFromCurrentImageContext(); 
Powiązane problemy