Matt S.
Matt S.

Reputation: 13753

UIButton background image looks fine in sim, but not on device

I manually set my UIButton's background by using the following:

[button setBackgroundImage:[[UIImage imageNamed:@"button.png"] stretchableImageWithLeftCapWidth:10 topCapHeight:0] forState:UIControlStateNormal];

On the simulator this looks fine, however on the device it looks horrendous. It looks like this:

image

I'm not entirely sure what's causing this. I do have an autoresizing mask set (UIViewAutoresizingFlexibleWidth), but disabling it still causes this.

Upvotes: 0

Views: 229

Answers (1)

danh
danh

Reputation: 62676

Somebody else on stack overflow was getting stretch artifacts because of a "Compress PNG" files" project setting. How is your's set?

Upvotes: 1

Related Questions