如何在ios的Textview中显示Telugu字体?

时间:2014-05-22 05:55:38

标签: ios iphone objective-c xcode

UITextView中可以设置fontname.I想在UITextview中显示Telugu字体。这是Telugu字体系列名称" TeluguSangamMN-Bold" .I我正在UITextview宣布泰卢固语字体系列。但它对我不起作用。帮助我任何身体。

这是我的代码..

-(void)connectionDidFinishLoading:(NSURLConnection *)connection

{

[UIApplication sharedApplication].networkActivityIndicatorVisible=NO;

if(connection==urlConnection)

{

NSString *strResponse=[[NSString alloc]initWithData:responseData encoding:NSUTF8StringEncoding];

NSLog(@"String Response is : %@",strResponse);

NSRange r;

NSString * cleanString = [NSMutableString stringWithString:strResponse];

while ((r = [cleanString rangeOfString:@"<[^>]+>" options:NSRegularExpressionSearch]).location != NSNotFound)

cleanString = [cleanString stringByReplacingCharactersInRange:r withString:@"\n"];

text1.text=cleanString;

}

}

-(void)viewDidLoad

{

text1=[[UITextView alloc]initWithFrame:CGRectMake(10, 300, 300, 80)];

text1.font=[UIFont fontWithName:@"TeluguSangamMN-Bold" size:12];

text1.font=[UIFont boldSystemFontOfSize:12];

text1.backgroundColor=[UIColor whiteColor];

text1.editable=NO;

[self.view addSubview:text1];

}

4 个答案:

答案 0 :(得分:1)

enter image description here检查您是否在plist中添加了扩展名为.dfont ot .ttf的字体文件

答案 1 :(得分:1)

您尝试使用的字体包含在iOS 7.0中。

您可以查看已安装的字体列表Here 同样在Fonts下的nib文件中显示。

enter image description here

答案 2 :(得分:0)

  1. 您是否已将自定义字体文件添加到INFO.PLIST
  2. 此外,文件名与字体系列名称不同,请尝试循环到[UIFont familyNames]并检查是否列出了您的字体系列名称。
  3. 尝试在text1.font=[UIFont fontWithName:@"TeluguSangamMN-Bold" size:12];
  4. 中使用相同的姓氏

答案 3 :(得分:0)

首先下载相关字体

将自定义字体添加到项目中,即将字体文件(Berlin Sans FB.TTF)拖动到XCode项目中。

添加一个新条目,其中包含&#34;应用程序提供的字体&#34;。

enter image description here

现在在textview中使用此字体

txtview.font = [UIFont fontWithName:@"Berlin Sans FB" size:15];

我使用柏林Sans FB你使用teleugu字体

有关详情,请查看this link