Macos 如何使用表情符号制作NSTextfield?
我正在尝试在mac上开发XMPP聊天客户端。 我想让带有表情符号的聊天文本字段像Skype一样 我试着这样做: NSMutableAttributedString*mastring=[[NSMutableAttributedString alloc]initWithAttributedString:astring]; NSImage*emoticon=[NSImage imagename:@“smile.png”]; NSTextAttachmentCell*attachmentCell=[[NSTextAttachmentCell alloc]initImageCell:emoticon]; NSTextAttachment*附件=[[NSTextAttachment alloc]init]; [附件setAttachmentCell:attachmentCell]; NSAttributedString*attributedString=[NSAttributedString attributedStringWithAttachment:attachment]; [allstring insertAttributedString:attributedString索引:1]; 因此,我将表情图标图像插入到NSTextField中,但无法将表情图标图像复制/粘贴到另一个NSTextField中。 请给我技术。谢谢大家 NSMutableAttributedString* mastring = [[NSMutableAttributedString alloc] initWithAttributedString:astring]; NSImage * emoticon = [NSImage imageNamed:@"smile.png"]; NSTextAttachmentCell *attachmentCell = [[NSTextAttachmentCell alloc] initImageCell:emoticon]; NSTextAttachment *attachment = [[NSTextAttachment alloc] init]; [attachment setAttachmentCell: attachmentCell ]; NSAttributedString *attributedString = [NSAttributedString attributedStringWithAttachment: attachment]; [allstring insertAttributedString:attributedString atIndex:1];Macos 如何使用表情符号制作NSTextfield?,macos,cocoa,nstextfield,rich-text-editor,emoticons,Macos,Cocoa,Nstextfield,Rich Text Editor,Emoticons,我正在尝试在mac上开发XMPP聊天客户端。 我想让带有表情符号的聊天文本字段像Skype一样 我试着这样做: NSMutableAttributedString*mastring=[[NSMutableAttributedString alloc]initWithAttributedString:astring]; NSImage*emoticon=[NSImage imagename:@“smile.png”]; NSTextAttachmentCell*attachmentCell=[[N