I am working on a children\'s book app and would like to dynamically populate speech bubble(s) for character dialogues as shown in attached screenshots. Screenshots are from
Another way of doing this is through the use of images with cap insets. Take a look at the UIImage method:
resizableImageWithCapInsets:
Basically you can create an image of a minimum sized bubble, and have it stretch indefinitely while maintaining the look of the 'bubble' borders.
The code below specifies an image where 12 pixels on the top, left, bottom and right be preserved when stretching/resizing the image:
UIImage *bubble = [[UIImage imageNamed:@"bubble.png"]
resizableImageWithCapInsets:UIEdgeInsetsMake(12, 12, 12, 12)];
UIImageView *imgView = [[[UIImageView alloc] initWithImage:bubble] autorelease];
imgView.frame = CGRectZero;
Animating the size change of a UIImageView comes for free:
[UIView animateWithDuration:0.3
animations:^(void) {
imgView.frame = CGRectMake(50, 50, 200, 100);
} completion:^(BOOL finished) {
}];