【发布时间】:2010-12-26 08:47:40
【问题描述】:
我想用 Quartz 画一些文字。现在应用程序绘制 ,但我希望它显示为“0123456789”。有什么方法可以显示它的正常方向吗?
这是我的代码:
//set image view
drawImage = [[UIImageView alloc] initWithImage:nil];
drawImage.frame = self.view.frame;
[self.view addSubview:drawImage];
UIGraphicsBeginImageContext(self.view.frame.size); // begin
// current context
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSelectFont(context, "Courier", 40, kCGEncodingMacRoman);
CGFloat white[] = {1.0, 1.0, 1.0, 1.0};
CGContextSetFillColor(context, white);
CGContextShowTextAtPoint(context, 0, 30, "0123456789", strlen("0123456789"));
// get image
drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext(); // end
【问题讨论】:
标签: iphone objective-c text rotation quartz-graphics