I am creating a chat app. I have to stretch the bubble
image according to the text like other chatapps
. I am using AutoLayout constraints. Size of imageview containing bubble increaser perfectly. (I have given yello background color to it). The bubble image is not getting stretched.
I have added these constraints:
For stretching image I have added this:
let myImage = self.imageNamed("Bubble_Me")
let new_Image = myImage.stretchableImage(withLeftCapWidth: 15, topCapHeight: 14)
cell.bubbleImage.image = new_Image
If anyone have idea about this, please respond. Thanks in advance.
First get the size of your text by using this.
After you get the frame of your text then get the height from the frame of text and put height into the imageView of the bubble. this all things done into the tableViewCell custom class into the
-(void)layoutSubviews method.