卡在学习编程 3 散落的表情符号,求助!!!
swift吧
全部回复
仅看楼主
level 1
卡在这里走不动了 求助呀!!1
2018年07月10日 08点07分 1
level 1
let emoji = "✨🌝🔦💫👀☄️🌎"
// ✏️ 将表情符号分离成单个字符的字符串数组。
let character = emoji.componentsByCharacter()
// 字符数组中下一个项目的索引。
var index = 0
// ✏️ 将 chosenEmoji 设为字符数组的项目索引。
let chosenEmoji = character[index]
// 从选择的表情符号创建图形。
let graphic = Graphic(text: chosenEmoji)
// ✏️ 递增索引以指向下一个项目。
index += 1
// ✏️ 当索引到达数组末尾时还原索引。
if index == character.count {
index = 0
}
// 设定 `scale` 和 `rotation`。
graphic.scale = 1.5
graphic.rotation = randomDouble(from: 0.0, to: 180)
2019年09月25日 08点09分 2
1