Drag 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.
To use Sticker keyboard please login to CometChat Administration Panel and add Stickers Plugins from the Plugins Tab.
Include the class <StickersFramework/StickersFramework.h> in the .h file of your class.
1. Initialize the CometChat object
StickersControlMethodViewController *sticker = [[StickersControlMethodViewController alloc] init];
2. Show sticker keyboard
Create a user with given userName and password. (Ensure that userName and password cannot be nil or empty)
- (UIView *)stickerKeyboardSetFrame:(float)setX
viewWidth:(float)setWidth
viewHeight:(float)setHeight;
Parameters:
(i). setX: set to 0.
(ii). setWidth: width of the sticker keyboard.
(iii). setHeight: height of the sticker keyboard.
[sticker stickerKeyboardSetFrame:0 viewWidth:self.view.frame.size.width viewHeight:self.view.frame.size.height];
3. Get seleted stickers
To get selected stickers you may implement getSelectedStickers method in viewDidLoad.
- (void)getSelectedStickers:(void(^)(NSDictionary *response))success;
Callback Block:
(void(^)(NSDictionary *response))response
Invocation: After the user’s details have been updated successfully.
Response: NSDictionary containing the status and the message
Eg:
{
"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) {
[cometChatChatroom sendChatroomStickers:[NSString stringWithFormat:@"%@",[response objectForKey:@"data"]]
toChatroom:currentRoomName
withChatroomID:currentRoomID
withsuccess:^(NSDictionary *response) {
} failure:^(NSError *error) {
}];
}];
4. Hide stickers keyboard
If you want to hide sticker keyboard you may use following method.
- (void)hideStickerKeyboard:(BOOL)flag;
Usage:
[sticker hideStickerKeyboard:YES];
Not finding what you need?
The CometChat team is here to help!