Friday 14 August 2015

Emoji support in ios Application

Open the emoji keyboard


You can find the emoji keyboard in any app that uses the standard keyboard. Tap in a text field, then tap Smiley face icon. If you have multiple keyboards turned on, press and hold Globe icon, then select Emoji




In iOS 8.3 and later, you can change the skin tone of some emoji. Tap and hold an emoji to see different skin tone variations. When you choose a skin tone, it will be saved as the default.


If you don't see the emoji keyboard
Make sure that the emoji keyboard is turned on:
  1. Tap Settings > General > Keyboard.
  2. Tap Keyboards.
  3. Tap Add New Keyboard.
  4. Tap Emoji.

Now how to support in IOS application 

In one of my application i have to send description in which i am adding smily :) . i have to encode the text and then send them and as well when i am displaying them i have to convert them . Lets see how.

When you send to server:


    NSString *uniText = [NSString stringWithUTF8String:[self.txtDesc.text UTF8String]];
    NSData *msgData = [uniText dataUsingEncoding:NSNonLossyASCIIStringEncoding];
    NSString *goodMsg = [[NSString alloc] initWithData:msgData encoding:NSUTF8StringEncoding] ;


and we display text do this way:


    -(NSString*)displayEmojiText:(NSString*)strText{
        NSData *emojiData = [strText dataUsingEncoding:NSUTF8StringEncoding];
        NSString *emojiString = [[NSString alloc] initWithData:emojiData encoding:NSNonLossyASCIIStringEncoding];
        return emojiString;
    }

[self.lblPostDescription setText:[APP_DELEGATE displayEmojiText:description]]