0

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.

egor.zhdan
  • 4,555
  • 6
  • 39
  • 53

2 Answers2

2

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.

Peter Hosey
  • 95,783
  • 15
  • 211
  • 370
  • 1
    @egor239: Yeah, if you need to stretch the bubble vertically as well as horizontally, you'll need to go to nine parts. (Or switch to drawing the bubble in code, if you don't want it to have a solid background in the middle.) – Peter Hosey Jul 07 '13 at 08:23
1

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

kerry
  • 2,362
  • 20
  • 33