(Created page with "== UIImage == === Method stretchableImageWithLeftCapWidth:topCapHeight: === If you want to have a stretchable UIView with your own image you can use the object method stretcha...") |
(No difference)
|
Revision as of 10:13, 1 March 2012
UIImage
Method stretchableImageWithLeftCapWidth:topCapHeight:
If you want to have a stretchable UIView with your own image you can use the object method stretchableImageWithLeftCapWidth:topCapHeight: from an UIImage.
For example a stretchable speech bubble:
First without this method:
UIImage* img=[UIImage imageNamed:@"SpeachBubble"];
UIImageView* imgView=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 500, 300)];
imgView.image=img;
[self.view addSubview:imgView];
[imgView release];
The result is: File:SPEACHBUBBLEBEFORE.png
Now with this method:
UIImage* img=[[UIImage imageNamed:@"SpeachBubble"] stretchableImageWithLeftCapWidth:90 topCapHeight:80];
UIImageView* imgView=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 500, 300)];
imgView.image=img;
[self.view addSubview:imgView];
[imgView release];
Now the result is: