Ios 在xcode中为自定义键盘创建自己的表情符号
在Xcode中,我尝试向自定义键盘添加一些表情符号。我想为表情符号使用图像 由于我不知道如何将图像转换为表情符号,我在创建发送消息中按钮图像的按钮时遇到问题。如何创建发送消息中按钮图像的按钮 我曾尝试将图像转换为NSdata,但尝试失败 这是我的一些密码Ios 在xcode中为自定义键盘创建自己的表情符号,ios,xcode,uibutton,uiimage,custom-keyboard,Ios,Xcode,Uibutton,Uiimage,Custom Keyboard,在Xcode中,我尝试向自定义键盘添加一些表情符号。我想为表情符号使用图像 由于我不知道如何将图像转换为表情符号,我在创建发送消息中按钮图像的按钮时遇到问题。如何创建发送消息中按钮图像的按钮 我曾尝试将图像转换为NSdata,但尝试失败 这是我的一些密码 -(void) addGestureToKeyboard{ [self.keyboard.deleteKey addTarget:self action:@selector(pressDeleteKey) forControlEvents:U
-(void) addGestureToKeyboard{
[self.keyboard.deleteKey addTarget:self action:@selector(pressDeleteKey)
forControlEvents:UIControlEventTouchUpInside];
[self.keyboard.enterKey addTarget:self action:@selector(pressEnterKey)
forControlEvents:UIControlEventTouchUpInside];
[self.keyboard.nextKey addTarget:self action:@selector(advanceToNextInputMode)
forControlEvents:UIControlEventTouchUpInside];
[self.keyboard.smileyKey addTarget:self action:@selector(pressSmileyKey:)
forControlEvents:UIControlEventTouchUpInside];
for (UIButton * keys in self.keyboard.keysArray) {
[keys addTarget:self action:@ selector(pressKey:)
forControlEvents:UIControlEventTouchUpInside];
}
}
-(void) pressDeleteKey{
[self.textDocumentProxy deleteBackward];
}
-(void) pressEnterKey{
[self.textDocumentProxy insertText:@"\n"];
}
-(void) pressKey:(UIButton *) key{
[self.textDocumentProxy insertText:[key currentTitle]];
}
-(void) pressSmileyKey:(UIButton *) skey{
NSData *imageData= UIImageJPEGRepresentation([skey currentImage], 1.0);
[self.textDocumentProxy insertText: imageData];
}
您是否有任何代码可以更精确地指出您的问题?这将增加你得到答案的机会。谢谢你的建议。我已经添加了一些代码和关于这个问题的更多信息。