UIFont * font = [UIFont fontWithName: @ "Arial" size: 16.0];
NSString * str = [[NSString alloc] initWithString: @ "Hello"];
[Str drawAtPoint: CGPointMake (100, 100) withFont: font];
[Str release];
Output Hello, is white, how to set the font color
Reply:
You do not know what you want to display this NSString above it?
Set the color generally have textColor,
color attributes of the classFor example, you want to show there is a label in the label above the textColor attribute. . .
Reply:
NSString is a string class, regardless of the display,
Color drawAtXX method in setting,
Or use UILabel,, there textColor or color attributes of the class can be set UITextView
- (Void) drawRect: (CGRect) rect {
NSString * hello = @ "Hello, World!";
CGPoint location = CGPointMake (10, 20);
UIFont * font = [UIFont systemFontOfSize: 24.0];
[[UIColor whiteColor] set];
[Hello drawAtPoint: location withFont: font];
}
Reply:
Thank you upstairs to answer!
No comments:
Post a Comment