ios 使用自定义字体

iOS使用自定义字体,比如楷体 iOS中的大部分字体都是对英文才有作用,想用楷体,并没有作用,那就要用自定义的字体。 1. 下载自己需要的字体的ttf文件,并且导入到自己的项目中,如图 2. 在info.plist中添加Fonts provided by application配置项,然后把ttf文件添加进去,如图 3. 如果不知道自己添加的这个字体的名字,可以遍历字体库,通过如下代码:     阅读详情

1、下载要使用的自定义字体,格式通常为ttf、otf文件.这里假设是nokia.ttf

2、把nokia.ttf文件导入xcode的资源中

3、在xxx.plist文件中添加Fonts provided by application.类型是Array。xxx是你的项目名称。添加一项,值为“nokia.ttf”.

4、在程序初始化的代码中加入以下代码:

 NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
        NSArray *fontNames;
        NSInteger indFamily, indFont;
        for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
        {
            NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
            fontNames = [[NSArray alloc] initWithArray:
                         [UIFont fontNamesForFamilyName:
                          [familyNames objectAtIndex:indFamily]]];
            for (indFont=0; indFont<[fontNames count]; ++indFont)
            {
                NSLog(@"    Font name: %@", [fontNames objectAtIndex:indFont]);
            }
            [fontNames release];
        }
        [familyNames release];

这样通过日志可以找出你添加的字体的名称,我的这个叫“NokiaFontGuYin”

5、使用这个字体.UIFont *font=[UIFont fontWithName:@"NokiaFontGuYin" size:36];

iOS字体自定义 iOS_TTF字体自定义 立即下载

相关推荐

解密UFS Explorer:Drobo BeyondRAID数据恢复实战指南

本文详细介绍了使用UFS Explorer Professional Recovery软件中的Drobo BeyondRAID助手进行数据恢复的完整实战流程。当Drobo设备因BeyondRAID配置信息丢失而无法访问时,该工具能安全、只读地扫描硬盘,虚拟重建存储池,帮助用户找回宝贵数据。指南涵盖了从前期准备、硬盘选择、配置扫描到数据安全导出的每一步关键操作与常见问题解决方案。

weixin_29219539的博客 269

【iOS】自定义字体

在设计App的过程中我们常常会想办法去让我们的界面变得美观,使用好看的字体是我们美化界面的一个方法。接下来笔者将会讲解App中添加自定义字体。

weixin_72437555的博客 2891

别再硬啃C代码了!用Simulink的Matlab Function模块手把手教你搭建CRC8校验模型(附完整M脚本)

本文详细介绍了如何利用Simulink的Matlab Function模块轻松实现CRC8校验模型,替代传统的C代码编写。通过可视化建模和即时验证,开发者可以高效完成算法设计,并自动生成嵌入式代码。文章包含完整的M脚本示例和工程实践技巧,特别适合嵌入式系统开发人员提升工作效率。

weixin_42520661的博客 183

iOS使用自定义字体

1、添加自定义ttf字体文件到项目中;2、在Info.plist中添加一项:Fonts provided by application,填写字体文件名称加后缀.如图:3、使用字体,这里需要注意的是要知道字体文件对应的名称如图:文件名是 test,对应字体名是 经典趣体简 所有当我们使用时候应该是这样的:self.title.font=[UIFont fontWithName:@"经典趣体简" s

l1050765093的博客 348

DeepL Pro免费使用技巧与API调用优化方案

机器翻译技术通过神经网络模型实现跨语言语义转换,其核心价值在于保持专业术语准确性的同时实现自然语言流畅度。现代翻译工具如DeepL采用注意力机制等深度学习技术,在医疗、法律等专业领域展现出接近人工翻译的质量。针对API调用场景,开发者可通过请求模拟实现小批量自动化处理,而文档预处理和术语库优化则能显著提升免费额度使用效率。本文重点解析如何通过字符计算优化、临时接口调用等工程实践方法,在合规前提下最大化利用免费翻译资源。

weixin_29038303的博客 265

FPGA之道(22)VHDL基本程序框架

在介绍详细的VHDL语法之前,让我们先来了解一下VHDL代码的基本程序框架,这样可以让我们先对VHDL程序设计有一个整体的概念把握,进而在后续的VHDL语法学习中做到有的放矢。

Reborn Lee 8306

iOS 使用自定义字体

iOS 项目中使用自定义字体

尘缘驿站 1390

华为OD机试 - 最快到达医院的方法(Python/JS/C/C++ 2024 E卷 100分)

刷的越多,抽中的概率越大,私信哪吒,备注华为OD,加入华为OD刷题交流群,每一题都有详细的答题思路、详细的代码注释、发现新题目,随时更新,全天优快云在线答疑。

学Java,找哪吒 2167

添加字体

1、下载资源:后缀为.ttf或odf 例如:http://www.webpagepublicity.com/free-fonts.html 2、把字体库导入到工程的resouce中; 3、在工程的Info.plist文件中新建一行(Add Row),添加Key:Fonts provided by application,类型为Array或Dictionary;然后新建一个键值对,key为:Item

xiaoxiaobukuang的专栏 602

49、Linux内核内存管理:MGLRU、DAMON与OOM杀手详解

本文详细解析了Linux内核内存管理中的三大核心机制:MGLRU(多代LRU)页面追踪与回收机制、DAMON数据访问监控工具及其在内存优化中的应用,以及OOM(内存不足)杀手的工作原理和触发方式。同时,文章还介绍了VM overcommit_memory策略的设置及其对内存分配的影响,帮助开发者和系统管理员更好地理解Linux内存管理机制,从而优化系统性能和稳定性。

dropout6artist的博客 107

一个代码循环计算水在石墨烯表面的接触角

石墨烯接触角

Rockyoung 2573

在iOS开发中使用自定义字体

在iOS的项目开发中经常遇到需要使用一些自定义的字体文件,比如仿宋_GB2312、方正小标宋_GBK等。之前我们为了使用这些自定义的字体,在应用的资源包中放入这些字体文件。因为字体文件通常比较大,有的一个字库就达到10M以上(拿方正小标宋_GBK这个字库来说就有13M之多),这样打包后的ipa文件的体积就可能会变得很大,对于只有个别的模块需要特殊的字体样式的应用来说很不划算,那么在iOS6.0以后

qq_19732563的博客 1741

【UE5】RTS游戏的框选功能+行军线效果实现

步骤: 一、项目准备; 二、框选NPC并移动到指定地点; 三、框选效果; 四、行军线效果

ChaoChao66666的博客 2378

iOS使用自定义字体 两种方法

iOS使用自定义字体 2012-9-18 09:05| 发布者: benben| 查看: 281| 评论: 0 摘要: 准备:你的自定义字体文件-〉ttf,odf字体文件。现在网上一般下的中文字体文件都是ttc格式的,这个需要转换一下,网上有很多转换工具,不过都是windows下面的。(ttc就是多个ttf压在一起形成的)使用:1.加入工程中2 ...

起点 4953

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

iOS - 使用自定义字体-苹方字体

苹方提供了六个字重,font-family 定义如下:苹方-简 常规体font-family: PingFangSC-Regular, sans-serif;苹方-简 极细体font-family: PingFangSC-Ultralight, sans-serif;苹方-简 细体font-family: PingFangSC-Light, sans-serif;苹方-简 纤细体font-fami

gongyuhonglou的博客 6665

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

iOS中使用自定义字体

之前的好几个项目,客户都要求使用微软雅黑字体,可是iOS没有自带这个字体,肿么办  只能自己自定义字体了,下面是自定义字体的几个重要步骤: 1、下载字体资源文件(.ttf或.otf格式的文件) 比如说你要使用微软雅黑字体,就需要下载微软雅黑字体文件。 需要注意的是,.otf格式的文件只能在iOS5之后才能使用,所以假如你的系统需要在iOS5.0之前的版本中使用的话,最好使用.ttf

yhawaii的专栏 5317

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

iOS中使用自定义字体, 动态下载字体

在iOS的开发中经常遇到需要使用一些自定义的字体文件,比如仿宋_GB2312、方正小标宋_GBK等。之前我们为了使用这些自定义的字体,在应用的资源包中放入这些字体文件。因为字体文件通常比较大,有的一个字库就达到10M以上(拿方正小标宋_GBK这个字库来说就有13M之多),这样打包后的ipa文件的体积就可能会变得很大,对于只有个别的模块需要特殊的字体样式的应用来说很不划算,那么在iOS6.0以后苹果就开放了动态加载字体的权限。下面就iOS中使用字体的这两种方式进行介绍。 使用静态字体 1、将字体文件拷贝到

gcs的博客 3844

iOS使用自定义字体, 本地字体

首先是最简单也普遍的做法,打包内置字符库文件: 步骤如下: 1.第一步找到你想用的字体的 ttf 格式。加入到你的工程的resouce目录下。 2.在工程的plist中AddRow,“Fonts provided by application” ,然后添加key为item0,value为你刚才加入的testFont.ttf 。 是这样,可以添加多个,使用的时候写对应字体名字就行。 3.然后就可以使用了。xx.font = [UIFont fontWithName:@"fontName.

gcs的博客 1201

如何在iOS应用中使用自定义字体

最近的项目需求需要使用新的字体,而且是在 所有地方 也就是说不管是普通的cell中的label,还是导航栏中的标题,都要使用设计新给出的字体。而新的字体包含在一个ttf的文件中。乍一听到是挺浩大的一个工程,如果我是一个笨蛋的话估计会去每一个显示文字的界面,去修改相应的设置Font的方法,再稍微聪明一点可能在一个统一的地方编写一个比如- (UIFont *)customFontWithSize:(CG

小工匠的专栏 969

关于iOS添加自定义字体、字体图的使用,oc和swift。

1、在Xcode项目中导入 字体库.tff 文件 2、在info.plist 文件中添加  Key:    Fonts provided by application    Type:  Array    添加导入的tff文件名。 3、调用字体库  UILabel 和 UIButton UIFont *font = [UIFont fontWithName:@"字体库文件名" siz

i_k_o_x_s的专栏 2403

ios开发中使用自定义字体

在做一些阅读/古文化/文学相关的app时,难免遇到shi'y

u010794652的专栏 1114
上一篇: ios UIView 动画效果
下一篇: IOS 启动图片
yesjava
博客等级 码龄19年 69粉丝 153原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值