我一直在嘗試使用Quartz上下文顯示文本,但無論我嘗試過什麼,我只是沒有運氣讓文本顯示(但我可以顯示各種其他Quartz對象) 。任何人都知道我可能會做錯什麼?如何在iPhone上使用Quartz顯示文本?
例如:
-(void)drawRect:(CGRect)rect
{
// Drawing code
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSelectFont(context, "Arial", 24, kCGEncodingFontSpecific);
CGContextSetTextPosition(context,80,80);
CGContextShowText(context, "hello", 6);
//not even this works
CGContextShowTextAtPoint(context, 1,1, "hello", 6);
}
它應該是@「Sample Text」,因爲函數需要一個NSString *。它適用於我,否則,謝謝。但是我找不到引用drawAtPoint函數,這是令人擔憂的。 – CiscoIPPhone 2010-11-01 19:24:57
drawAtPoint是UIKit NSString類別的一部分 - http://developer.apple.com/library/ios/#documentation/uikit/reference/NSString_UIKit_Additions/Reference/Reference.html – Hunter 2011-01-07 19:19:21