Can i use a Tally marks fonts in UILabel?

泪湿孤枕 提交于 2019-12-25 02:22:26

问题


does Apple support usage of tally fonts ? i'm using this tally from here :http://www.subtangent.com/maths/resources.php

with this coding:

  UILabel *subtitle = [[UILabel alloc]initWithFrame:CGRectMake(125, 2, 185, 30)];
    [subtitle setBackgroundColor:[UIColor clearColor]];
    [subtitle setFont:[UIFont fontWithName:@"Tally_Regular.ttf" size:19.0]];
   [subtitle setText:@"5"];
    [subtitle setTextColor:[UIColor blackColor]];
    [fLikeThis    addSubview:subtitle];

However it does't work as expected, not sure why as i also entered the font name in "Fonts provided by application".


回答1:


In "Fonts provided by application" you need to add file name e.g. your ttf file not font name modify your info plist as follow:-

<key>UIAppFonts</key>
<array>
    <string>yourfontfilename.ttf </string>
</array>

and use font name in label :-

[subtitle setFont:[UIFont fontWithName:@"fontname" size:19.0]];//This is your font name not your font file name.You can get font name by opening it with fontbook in mac.

if still not working then may be something wrong in ttf file.



来源:https://stackoverflow.com/questions/8484937/can-i-use-a-tally-marks-fonts-in-uilabel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!