Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/93.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在xcode中为自定义键盘创建自己的表情符号_Ios_Xcode_Uibutton_Uiimage_Custom Keyboard - Fatal编程技术网

Ios 在xcode中为自定义键盘创建自己的表情符号

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

在Xcode中,我尝试向自定义键盘添加一些表情符号。我想为表情符号使用图像

由于我不知道如何将图像转换为表情符号,我在创建发送消息中按钮图像的按钮时遇到问题。如何创建发送消息中按钮图像的按钮

我曾尝试将图像转换为NSdata,但尝试失败

这是我的一些密码

-(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];
}

您是否有任何代码可以更精确地指出您的问题?这将增加你得到答案的机会。谢谢你的建议。我已经添加了一些代码和关于这个问题的更多信息。