2013-03-02 58 views
1

我正在使用以下UNICODES设计iPad上的表情图标菜单,但我无法自定义其高度。在iOS中设置Unicode字符宽度

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

我需要提高的Unicode字符高度/宽度。

回答

2

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

我也同样与OSX应用

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]]; 
} 

下面的代码,并得到了输出相当不错: enter image description here

编辑:

对于NSButton:

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

对于iOS:

现在我试着用ios,它工作。你可以检查大小5和50的差异

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

伟大的答案:) – Rushabh 2013-03-02 07:33:43

+0

感谢您的回复,我在UIButton上实现它们。我增加了Button的字体和框架。但它不起作用。 请帮忙 – user1829463 2013-03-02 08:47:09

+0

我试过用NSButton和那工作! '[self.button setFont:[NSFont fontWithName:@“Helvetica-BoldOblique”size:30.0]]; [self.button setTitle:arrayEmoticons [3]];' – 2013-03-02 08:56:20