Emoji / Stickers Keyboard

Emoji Keyborad

To add Emoji keyboard, no development is needed.
You can enable Emoji Keyboard from the setting section of your iPhone device.
Go to iPhone Settings > General > Keyboards > Keyboards > Add New Keyboard and select Emoji.

Stickers Keyboard

Add the StickersFramework.framework and StickersFramework.bundle into your Xcode project folder target.
Make sure the “Copy items to destination’s group folder” checkbox is checked.
CC_1
Enable sticker plugin from CometChat Admin Panel.

Include the class <StickersFramework/StickersFramework.h> in the .h file of your class.

Initialize the Sticker Controller object

StickersControlMethodViewController *sticker = [[StickersControlMethodViewController alloc] init];

stickerKeyboardSetFrame

Sets dimensions for the keyboard
Method Signature:

  (UIView *)stickerKeyboardSetFrame: (float)setX
                          viewWidth: (float)setWidth
                         viewHeight: (float)setHeight;

Arguments:

setX:

set to 0.

setWidth:

width of the sticker keyboard. 

setHeight:

 height of the sticker keyboard.

Usage:

 [sticker stickerKeyboardSetFrame: 0 
                        viewWidth: self.view.frame.size.width
                       viewHeight: self.view.frame.size.height
];

getSelectedStickers

To get selected stickers you can implement getSelectedStickers method in viewDidLoad.

Method Signature:

 (void)getSelectedStickers:(void(^)(NSDictionary *response))success;

Arguments:

success

A callback method

Method properties Description
Signature (void(^)(NSDictionary *response))response
Invocation After selecting a sticker
Response NSDictionary containing the sticker

Sample Response:

{
     "data" = "sticker_1.png";
}

Usage:

For One-on-One:

[sticker getSelectedStickers: ^(NSDictionary *response){
    [cometChat sendStickers: [NSString stringWithFormat: @"%@",[response objectForKey: @"data"]]
                     toUser: buddyID
                    success: ^(NSDictionary *response){}
                    failure: ^(NSError *error){}
    ];
  }
];

For Chatroom :

[sticker getSelectedStickers: ^(NSDictionary *response){
    [groupChat sendgroupStickers: [NSString stringWithFormat: @"%@",[response objectForKey: @"data"]] 
                                    toGroup: groupName 
                                withGroupID: groupID 
                                withsuccess: ^(NSDictionary *response){}
                                    failure: ^(NSError *error){}
    ];
  }
];

hideStickerKeyboard

The method Allows you to hide the sticker keyboard

 (void)hideStickerKeyboard: (BOOL)flag;

Usage:

[sticker hideStickerKeyboard: YES];
  • Was this helpful?
  • Yes   No