我正在尝试在Xcode中添加一个表情符号警报,但无法弄明白,任何帮助都非常感谢!\ XF0\x9F\X98\XB3
码:
if ((self.liveStreamTitle.text?.characters.count) == 0)
{
let alertView = UIAlertController.init(title: "Forgot something?", message: "Video Title is empty EMOJIHERE", preferredStyle: UIAlertControllerStyle.Alert)
alertView.addAction(UIAlertAction.init(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alertView, animated: true, completion: {
})
return;
}
Run Code Online (Sandbox Code Playgroud)
实际上你可以直接添加它们.
@IBAction func pressed(sender: AnyObject) {
let actionSheetController: UIAlertController = UIAlertController(title: "Are you sure?", message: "", preferredStyle: .Alert)
let cancelAction: UIAlertAction = UIAlertAction(title: " NO", style: .Cancel) { action -> Void in
//Do your task
}
actionSheetController.addAction(cancelAction)
let nextAction: UIAlertAction = UIAlertAction(title: " YES", style: .Default) { action -> Void in
//Do your task
}
actionSheetController.addAction(nextAction)
self.presentViewController(actionSheetController, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
您也可以使用Unicode执行此操作
let cancelAction: UIAlertAction = UIAlertAction(title: "\u{1F425}", style: .Cancel) { action -> Void in
let nextAction: UIAlertAction = UIAlertAction(title: "\u{1F426}", style: .Default) { action -> Void in
Run Code Online (Sandbox Code Playgroud)
或者这使用Unicode
let cancelAction: UIAlertAction = UIAlertAction(title: "\u{1F425} YES", style: .Cancel) { action -> Void in
let nextAction: UIAlertAction = UIAlertAction(title: "\u{1F426} NO", style: .Default) { action -> Void in
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1389 次 |
最近记录: |