0

我使用下一个代码来创建 png 文件。我需要用 Arial 24 写一些文字。我该怎么做?我找不到可以设置 Arial 字体样式的位置。

UIImage *image = [BSSharedObject getInstance].downloadedImage;
    UILabel *label = [[UILabel alloc]init];
    UIFont *font = [UIFont systemFontOfSize:24.0];


UIGraphicsBeginImageContextWithOptions(CGSizeMake(WIDTH, HEIGHT), NO, 1.0);
[message drawInRect:CGRectMake(INDENT, INDENT, WIDTH - 2 *INDENT ,600) withFont:font lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentLeft];
[image drawInRect:CGRectMake((WIDTH - INDENT - image.size.width), (HEIGHT - INDENT- image.size.height), image.size.width, image.size.height)];
UIImage *resultImage  = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

[BSSharedObject getInstance].createdImage = resultImage;

UIImage *im =  [BSSharedObject getInstance].createdImage;
return resultImage;
4

1 回答 1

3

[UIFont fontWithName:@"Arial" size:24]

这将为您提供所需的字体。可预测地调用systemFontOfSize会导致系统字体的返回 - 在 iOS 的情况下,您会得到Helvetica Neue

于 2012-10-11T22:35:42.580 回答