Reputation: 540
I have an image which is 1*90 with gradient and i want to use it as background for different height say for example for first row of height 90 then no issues but second one is 100 then third is of 80... hw do I do this?
Upvotes: 0
Views: 3976
Reputation: 7450
self.someImage = [[UIImage imageNamed:@"yourImage.png"]resizableImageWithCapInsets:UIEdgeInsetsMake(10, 0, 10, 0)];
that will resize image and keep 10 pixels at top, 0 at left, 10 at bottom and 0 at right. You can also try
self.backgroundView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yourImage.png"]] autorelease];
self.backgroundView.contentMode = UIViewContentModeScaleToFill;
Hope it helps
Upvotes: 3