2017-04-03 47 views
-3

如何使用一个Jannat LT阿拉伯字体在我工作的iOS应用程序。我是在Xcode 8。我用Objective C的工作需要通过出myProject的和在哪里使用这些字体我得到(.ttf)文件? 。我搜了很多,但我找不到正确的答案,请帮我解决这个问题。如何使用阿拉伯语自定义字体的目标C

+0

[iOS中自阿拉伯字体]的可能的复制(http://stackoverflow.com/questions/3691567/custom-arabic-font-in-ios) – Olaia

+0

你有什么已经需要一个修复试过吗?请分享一些代码。 – Koen

+0

其重复的问题:::检查此链接:http://stackoverflow.com/questions/27730658/change-default-font-to-custom-fonts-in-whole-app –

回答

1

按照以下步骤

1.)将字体拖放到您的项目中。

2)在你的plist定义您的字体名称。打开plist>右键>添加行>键入:Fonts provided by application>按+> yourFontName.ttf。

It look like this in info plist 

Fonts provided by application : Array : (2 items) 

item 0 : fontNameOne.ttf 
item 1 : fontNameTwo.ttf 

3.)您可以从故事板中检查它,也可以通过编程方式进行检查。

yourLabel.font=[UIFont fontWithName:@"yourFont" size:16.0f];//do not use .ttf here 
1

我的问题是你需要的字体,或者你需要的方式来实现它 I think this is a nice explanation on how to add a custom font

如果您需要的字体本身let me google it for you

更新

没有永远的文件名将与字体家族/字体名称一致,以便检查您可以使用的代码中的字体族是否可以使用

Swift3

for family: String in UIFont.familyNames { 
     print("\(family)") 
     for names: String in UIFont.fontNames(forFamilyName: family) { 
      print("== \(names)") 
     } 
    } 

对象 -

for (NSString* family in [UIFont familyNames]) { 
    NSLog(@"%@", family); 

    for (NSString* name in [UIFont fontNamesForFamilyName: family]) { 
     NSLog(@" %@", name); 
    } 
} 

请使用,以便我给你的链接来检查它是否工作正常

+0

我需要这个字体A Jannat LT,这是一个阿拉伯字体名称,UIFont *字体= [UIFont fontWithName:@“A Jannat LT”大小:24];但它不工作 – islahul

+0

我更新我的回答,最有可能的文件名称和字体名称不一样 – sken3r