2016-07-12 32 views
3

Xcodeの警告に絵文字を追加しようとしていますが、それを把握することはできません。 \ XF0 \ x9F \ x98 \ XB3iOSアプリのEmoji - 通知/通知 - Xcode/Swift

コード:

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; 

     } 
+0

あなたは、絵文字の正しい表現を入れた絵文字を含む良い記事とiOSに通知をプッシュする必要があります。https://arashnorouzi.wordpress.com/2011/08/31/adding-graphics-と絵文字 - リンゴプッシュ通知/ –

+0

文字列の真ん中に絵文字を入れて "私は幸福\ ue415" Seanのリンクをチェックしてください –

+0

うん、記事を読んだだけでメッセージを追加しようとした: ''ビデオタイトルは空です\ ue40d "'運がありません。 – Yatko

答えて

5

実際にあなたがちょうどそれらを直接追加することができます。

@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) 

} 

enter image description here

また、この使用してユニコード

ユニコード

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 

01を使用して

let cancelAction: UIAlertAction = UIAlertAction(title: "\u{1F425}", style: .Cancel) { action -> Void in 
let nextAction: UIAlertAction = UIAlertAction(title: "\u{1F426}", style: .Default) { action -> Void in 

enter image description here

それともこれを行うことができます

Emoji Unicode Chart

+0

Unicodeを使用した編集を参照してください: – tymac

+0

私はそれをIDEやエディタ(私はAtomを使用しています)に依存していると思うので直接追加できませんでしたが、メソッドは扱います!ありがとう! :) –