在iOS中设置unicode字符宽度 [英] Set unicode character width in iOS

查看:270
本文介绍了在iOS中设置unicode字符宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下UNICODES在iPad上设计表情符号菜单,但我无法自定义其高度。

I am using following UNICODES for designing Emoticons menu on iPad, but I am not able to customise its height.

arrayEmoticons=[[NSArray alloc]initWithObjects:@"\U0001F61D",
                @"\U0001F621",@"\U0001F61C",@"\U0001F47F",@"\U0001F603",
                @"\U0001F60D",@"\U0001F612",@"\U0001F637",@"\U0001F614",
                @"\U0001F60A",@"\U0001F633",@"\U0001F631",@"\U0001F628",
                @"\U0001F609",@"\U0001F601", nil];

我需要增加unicode字符的高度/宽度。

I need to increase the unicode character Height/Width.

推荐答案

你永远不会改变unicode值的大小,而是需要改变textField或textView的大小。

You never change the size of unicode values, instead you need to change the size of textField or textView.

我使用以下代码进行osx应用程序

I did same with following code for osx application

NSArray *arrayEmoticons=[[NSArray alloc]initWithObjects:@"\U0001F61D",
                @"\U0001F621",@"\U0001F61C",@"\U0001F47F",@"\U0001F603",
                @"\U0001F60D",@"\U0001F612",@"\U0001F637",@"\U0001F614",
                @"\U0001F60A",@"\U0001F633",@"\U0001F631",@"\U0001F628",
                @"\U0001F609",@"\U0001F601", nil];

NSLog(@"%@",arrayEmoticons);

[self.textView setFont:[NSFont fontWithName:@"Helvetica-BoldOblique" size:30.0]];


for (id icon in arrayEmoticons) {
  [self.textView setString:[NSString stringWithFormat:@"%@%@",self.textView.string,icon]];
}

输出相当不错:

And got the output quite good as :

编辑:

对于NSButton:

For NSButton:

[self.button setFont:[NSFont fontWithName:@"Helvetica-BoldOblique" size:30.0]]; 
[self.button setTitle:arrayEmoticons[3]];

对于iOS:

现在我试过与ios一起工作。您可以检查大小5和50的差异

Now I tried with ios, and it worked. You can check the difference for size 5 and 50

self.button.titleLabel.font = [UIFont systemFontOfSize:5]; 
self.button.titleLabel.font = [UIFont systemFontOfSize:50];  
self.button.titleLabel.text=arrayEmoticons[3];

这篇关于在iOS中设置unicode字符宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆