Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIImage stretch only a portion

So, lets say i have this sprite:

mbm
bcb
mbm

where each letter is a portion. (m: margin; b: border, c:center)

and I want a class that is able to repeat the b's and c as long as it needs to complete the view so i get something like this:

mbbbbbbbbbbbbbm
bcccccccccccccb
bcccccccccccccb
bcccccccccccccb
mbbbbbbbbbbbbbm

Is there something that can do this already? If it doesn't exist, any ideas on how to implement it?

like image 747
Diego Torres Avatar asked Dec 28 '22 18:12

Diego Torres


1 Answers

Could you not achieve this with this method ?

-(UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight

(see Apple UIImage Class Reference )

like image 160
louiscoquio Avatar answered Jan 11 '23 12:01

louiscoquio