I have to show the textview text smily in UILabel.
In the UILabel
-
lbl.text = @"Happy to help you \U0001F431;
its showing properly.
In UITextView
-
I tried to convert UITextView
text in string and then log is -
%F0%9F%99%88%F0%9F%99%89%F0%9F%99%8A
How to encode which i can show in UILabel
, anybody please suggest me.
Position the cursor in any text field you'd like to insert an emoji, like posting a tweet for example. Hold down the following three keys at the same time: Command+Control+Spacebar. This will bring up the emoji picker. Click the emoji you'd like to use and it'll be inserted where you left your cursor.
In any app with text editing capability, including Xcode, you can click on the Edit menu, then Emoji & Symbols. You'll see a panel with emoji. Choose any of them and they will appear in your code. Another way is to use the hotkey ⌃⌘Space (ctrl + cmd + space).
1 Tap the text field, then tap the Emoji button or the globe . 2 Use the gray icons at the bottom of the keyboard to switch emoji themes, or swipe left or right to view more. Tap the clock to see emoji that you've ... 3 To change the skin tone of certain emoji, tap and hold an emoji. 4 Tap an emoji to add it to your text field.
First off, let create an instance of UILable to display on viewport and assign required properties and set of constraints This label will be used to create our interactive text with funny emojis. Next, let's create a collection of emoji UIImage s and default icon sizes to use.
Find the emoji keyboard in any app that uses the standard keyboard, like Mail or Messages. To add an emoji: Tap the text field, then tap the Emoji button or the globe. Use the gray icons at the bottom of the keyboard to switch emoji themes, or swipe left or right to view more.
Don't see the emoji keyboard? 1 Go to Settings > General and tap Keyboard. 2 Tap Keyboards, then tap Add New Keyboard. 3 Tap Emoji. More ...
You can use ⌃ ⌘ Space
shortcut to show the symbols panels and just insert the emoji you're looking for directly without unicode:
lbl.text = @"Happy to help you 😺";
(just copy the code above to Xcode if you browser doesn't show the emoji)
NSString *str = @"Happy to help you \U0001F431";
NSData *data = [str dataUsingEncoding:NSNonLossyASCIIStringEncoding];
NSString *valueUnicode = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSData *dataa = [valueUnicode dataUsingEncoding:NSUTF8StringEncoding];
NSString *valueEmoj = [[NSString alloc] initWithData:dataa encoding:NSNonLossyASCIIStringEncoding];
_lbl.text = valueEmoj;
SWIFT - 3 OR HIGHER
let str = "Happy to help you \U0001F431"
let data : NSData = str.dataUsingEncoding(NSNonLossyASCIIStringEncoding)!
let valueUnicode : String = String(data: data, encoding: NSUTF8StringEncoding)!
let dataa : NSData = valueUniCode.dataUsingEncoding(NSUTF8StringEncoding)!
let valueEmoj : String = String(data: dataa, encoding: NSNonLossyASCIIStringEncoding)!
SWIFT - 4 OR HIGHER
let str = "Happy to help you \U0001F431"
let data : NSData = str.dataUsingEncoding(NSNonLossyASCIIStringEncoding)!
let valueUnicode : String = String(data: data as Data, encoding: String.Encoding.utf8)!
let dataa : NSData = valueUnicode.data(using: String.Encoding.utf8)! as NSData
let valueEmoj : String = String(data: dataa as Data, encoding: String.Encoding.nonLossyASCII)!
On Xcode version 7.2.1, You can use the below shortcut to show the symbols panels and insert the emoji:
shortcut: (pressed the below three keys together)
Ctrl Command Space
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With