我怎么做?在代码中插入图片?

时间:2013-07-22 06:46:43

标签: ios

(请在回答之前先检查一下链接,这样你才能得到我想说的内容)我在github中有check a code我在Xcode中找到了类似这样的代码class它的工作效果很好

[[NSArray arrayWithObjects:
                      @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"✨", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", @"", nil]retain];

修改: - 如何在数组中直接添加图像或者如何在Xcode Editor中启用表情符号键盘?

4 个答案:

答案 0 :(得分:4)

这是Unicode角色。记录NSArray。

\ Ud83d \ Ude04 - 露出嘴巴和微笑眼睛的笑脸

enter image description here

   "\Ud83d\Ude04",
"\Ud83d\Ude0a",
"\Ud83d\Ude03",
"\Ud83d\Ude09",
"\Ud83d\Ude0d",
"\Ud83d\Ude18",
"\Ud83d\Ude1a",
"\Ud83d\Ude33",
"\Ud83d\Ude0c",
"\Ud83d\Ude01",
"\Ud83d\Ude1c",
"\Ud83d\Ude1d",
"\Ud83d\Ude12",
"\Ud83d\Ude0f",
"\Ud83d\Ude13",
"\Ud83d\Ude14",
"\Ud83d\Ude1e",
"\Ud83d\Ude16",
"\Ud83d\Ude25",
"\Ud83d\Ude30",
"\Ud83d\Ude28",
"\Ud83d\Ude23",
"\Ud83d\Ude22",
"\Ud83d\Ude2d",
"\Ud83d\Ude02",
"\Ud83d\Ude32",
"\Ud83d\Ude31",
"\Ud83d\Ude20",
"\Ud83d\Ude21",
"\Ud83d\Ude2a",
"\Ud83d\Ude37",
"\Ud83d\Udc7f",
"\Ud83d\Udc7d",
"\Ud83d\Udc9b",
"\Ud83d\Udc99",
"\Ud83d\Udc9c",
"\Ud83d\Udc97",
"\Ud83d\Udc9a",
"\Ud83d\Udc94",
"\Ud83d\Udc93",
"\Ud83d\Udc98\U2728",
"\Ud83c\Udf1f",
"\Ud83d\Udca4",
"\Ud83c\Udfb5",
"\Ud83d\Udd25",
"\Ud83d\Udca9",
"\Ud83d\Udc4d",
"\Ud83d\Udc4e",
"\Ud83d\Udc4c",
"\Ud83d\Udc9d",
"\Ud83c\Udf8e",
"\Ud83c\Udf92",
"\Ud83c\Udf93",
"\Ud83c\Udf8f",
"\Ud83c\Udf86",
"\Ud83c\Udf83",
"\Ud83c\Udf84",
"\Ud83c\Udf81",
"\Ud83d\Udd14",
"\Ud83d\Udcbf",
"\Ud83d\Udcf7",
"\Ud83d\Udcbb",
"\Ud83d\Udca1"

查看How to enter unicode characters in a UILabel in Interface Builder?

  

你可以点击编辑 - >特殊字符...... - 你可以找到所有   unicode字符(包括表情符号)

答案 1 :(得分:3)

如果您的问题是如何直接在源代码中输入表情符号字符:

  • 在系统偏好设置中 - >键盘,激活“在菜单栏中显示键盘和字符查看器”选项。
  • 从菜单栏中选择“显示字符查看器”。
  • 如有必要,请从左上方的弹出窗口中选择“自定义列表...”并激活“表情符号”类别。
  • 在左栏中选择“表情符号”类别。
  • 双击任何字符,将其直接插入源代码:

enter image description here

答案 2 :(得分:3)

不需要unicode你可以像这样简单地拖放笑脸: -

看到这个firt你需要打开像bellow image这样的特殊角色: -

enter image description here

然后窗口打开如下: -

enter image description here

现在你只想把你想要在数组中显示的笑容作为你的问题:

 [[NSArray arrayWithObjects:@"",@"✅"nil]retain];

答案 3 :(得分:1)

NSArray *arr = [[NSArray alloc] initWithObjects:[UIImage imageNamed:@"1.png"],[UIImage imageNamed:@"2.png"],[UIImage imageNamed:@"3.png"], nil];