[英]iOS - notifications (local / remote) just open the app, not showing alerts
[英]Emoji in iOS app Alerts and Notifications - Xcode/Swift
我正在嘗試將表情符號添加到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;
}
實際上,您可以直接添加它們。
@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)
}
您也可以使用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
或者使用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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.