xcode UITextField 字体样式没有改变

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16582137/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:23:12  来源:igfitidea点击:

UITextField font style not changing

iphoneobjective-cxcodeinputtextfield

提问by scourGINHO

I have the following problem - I want to change the UITextField font to a custom one. I am using this line of code:

我有以下问题 - 我想将 UITextField 字体更改为自定义字体。我正在使用这行代码:

textField.font = [UIFont fontWithName:@"fontname.ttf" size:20];

I want to use this font: Neurm.ttfCan you please tell me what is wrong or just try it out and tell me is it working?

我想使用这种字体: Neurm.ttf你能告诉我有什么问题吗,或者只是尝试一下然后告诉我它是否有效?

采纳答案by Madhu

Its possible you may have not gone through some necessary steps to embed a custom font in your app.

您可能没有通过一些必要的步骤在您的应用程序中嵌入自定义字体。

Check;

查看;

and see if you missed anything.

看看你是否错过了什么。

回答by Dharmbir Singh

You doing wrong Because no need to set extension (fontname.ttf) in your string.

你做错了因为不需要在你的字符串中设置扩展名 (fontname.ttf)。

textField.font = [UIFont fontWithName:@"NEURM TTF" size:20];

and check following links how to use custom font in ios.

并检查以下链接如何在 ios 中使用自定义字体。

1.How to use custom font in iOS Apps?

1.如何在iOS Apps中使用自定义字体?

2.iPhone Development: how to use custom fonts?

2. iPhone 开发:如何使用自定义字体?

回答by mihir kumar panda

here

这里

someTf.font = [UIFont fontWithName:@"AlexBrush-Regular" size:20];

This is working correctly no need to give .ttf ext

这工作正常,无需提供 .ttf ext