草庐IT

drawAtPoint

全部标签

ios - drawAtPoint 不呈现 View 中的文本

我正在尝试使用drawAtPoint:pointwithAttributes:attrs方法将一个字符串附加到View,但是该字符串在View内的任何地方都看不到,或者至少我看不到它(可能是颜色与View相同,白色)。以下代码是我在ViewController的viewDidLoad中使用的代码:NSMutableDictionary*stringAttributes=[[NSMutableDictionaryalloc]init];[stringAttributessetObject:[UIColorredColor]forKey:NSForegroundColorAttribute

iphone - 如何为 NSString drawAtPoint 设置上下文?

我目前致力于封装许多[NSStringdrawAtPoint:withFont:]函数调用到一个方法,这样我就可以通过一次调用绘制很多字符串,但是我怎么能告诉方法在哪里画这些弦?如果我将CGContextRef传递给它会怎么样,如何将CGContextRef设置为当前上下文? 最佳答案 在iOS4及更高版本上,使用UIGraphicsPushContext(context)和UIGraphicsPopContext()包装NSStringdrawAtPoint调用。Seeacceptedanswerfor"UsingNSString