UIButton doesn't listen to content mode setting?
Posted
by Dan Ray
on Stack Overflow
See other posts from Stack Overflow
or by Dan Ray
Published on 2010-06-01T14:29:55Z
Indexed on
2010/06/01
14:33 UTC
Read the original article
Hit count: 576
firstButton is a UIButton of type Custom. I'm programmatically putting three of them across each cell of a table, thusly:
[firstButton setImage:markImage forState:UIControlStateNormal];
[firstButton setContentMode:UIViewContentModeScaleAspectFit];
[cell.contentView addSubview:firstButton];
Elsewhere, I'm telling it to clipToBounds. What I get is a crop of the center square of the image, rather than an aspect-scaled rendering of it. I've tried this lots of ways, including setting the mode property on firstButton.imageView, which also doesn't seem to work.
© Stack Overflow or respective owner