在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];
}
答案 0 :(得分:1)
检查您是否在plist中添加了扩展名为.dfont ot .ttf的字体文件
答案 1 :(得分:1)
答案 2 :(得分:0)
[UIFont familyNames]
并检查是否列出了您的字体系列名称。text1.font=[UIFont fontWithName:@"TeluguSangamMN-Bold" size:12];
答案 3 :(得分:0)
首先下载相关字体
将自定义字体添加到项目中,即将字体文件(Berlin Sans FB.TTF)拖动到XCode项目中。
添加一个新条目,其中包含&#34;应用程序提供的字体&#34;。
现在在textview中使用此字体
txtview.font = [UIFont fontWithName:@"Berlin Sans FB" size:15];
我使用柏林Sans FB你使用teleugu字体
有关详情,请查看this link