egor.zhdan
egor.zhdan

Reputation: 4595

Stretching an NSImage to make iMessage-like bubble

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.

Upvotes: 0

Views: 639

Answers (2)

kerry
kerry

Reputation: 2582

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

Upvotes: 1

Peter Hosey
Peter Hosey

Reputation: 96323

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.

Upvotes: 2

Related Questions