在iOS中设置Unicode字符宽度
我正在使用以下UNICODESdeviseiPad上的表情符号菜单,但是我无法自定义它的高度。
arrayEmoticons=[[NSArray alloc]initWithObjects:@"\U0001F61D", @"\U0001F621",@"\U0001F61C",@"\U0001F47F",@"\U0001F603", @"\U0001F60D",@"\U0001F612",@"\U0001F637",@"\U0001F614", @"\U0001F60A",@"\U0001F633",@"\U0001F631",@"\U0001F628", @"\U0001F609",@"\U0001F601", nil];
我需要增加unicode字符高度/宽度。
您永远不会更改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]]; }
得到的输出相当不错,如下所示:
编辑:
对于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];