くまちゃんのiOS/Androidゲームプログラミング

マイペースでゲームつくってます。

テキスト描画 【iOS7対応】

(2014.1.4追記)

iOS7になってテキスト描画に変更が生じました。なんでこんなに長くなったのか;

 

NSString* s=@"hogehoge";

UIFont* font=[UIFont fontWithName:@"ArialRoundedMTBold" size:18];

[s drawAtPoint:CGPointMake(20,0) withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName,[UIColorblueColor],NSForegroundColorAttributeName,nil]];

 

(iOS6.1) 

NSString* s=[NSString stringWithFormat:@"SCORE   %d", score];

[[UIColor whiteColor] set];

UIFont* font = [UIFont boldSystemFontOfSize:18];

[s drawAtPoint:CGPointMake(100,20) withFont:font];