UIFont *font=[UIFont fontWithName:@"Arial" size:16.0];
NSString *str=[[NSString alloc] initWithString:@"Hello"];
[str drawAtPoint:CGPointMake(100, 100) withFont:font];
[str release];
输出的Hello,为白色,如何设置字体颜色
NSString *str=[[NSString alloc] initWithString:@"Hello"];
[str drawAtPoint:CGPointMake(100, 100) withFont:font];
[str release];
输出的Hello,为白色,如何设置字体颜色
解决方案 »
- 想请教一下关于用户收藏如何实现更加高效合理
- NSDate中initWithString不能用,求解释啊~
- ios下关于ffmpeg的问题
- 为什么iPhone程序不从main函数退出?
- 大虾们推荐基本iphone开发的书啊?
- 难道真的让我放弃sublime
- AVPlayer, KVO释放问题
- 求移动开发书目表、工具表、硬件准备
- xcode5 之后的 interface builder的问题
- Flutter Column Row child children Container Padding Center 傻傻分不清楚?
- iphone开发用什么本???
- .net解析ios服务器端xml文件,怎么弄啊,急急急急,在线
比如你要显示在label上面 label就有一个textColor属性的
颜色在drawAtXX方法里设置,
或是用UILabel,UITextView之类的,有textColor或color的属性可以设置
- (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];}