I'm creating messenger, I have bubble:

enter image description here

I want to stretch it to something like this to add text:

enter image description here

How can I do it?

Thanks.

有帮助吗?

解决方案

Use the NSDrawThreePartImage function to draw the bubble.

It takes three NSImages, so you will need to chop up your source image into three separate images—either in your image editor, or in code—and use those.

其他提示

I have created a ditto iMessage like bubble using 4 UIViews. It is available in both code and XIB (UITableViewCell). It is highly customizable. You can change the color, font, font size, tail or no tail, etc. Do check it out here

https://github.com/kerrygrover/iMessageBubble

enter image description here

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top