TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Nov 2015 |
Maintained by Suyeol Jeon.
Total | 9,262 |
Week | 0 |
Month | 0 |
Apps | 177 |
Test Targets | 9 |
Stars | 17 |
Watchers | 3 |
Forks | 3 |
Issues | 1 |
Contributors | 1 |
Pull Requests | 0 |
Files | 2 |
LOCLines of Code | 63 |
A missing background content mode for UIButton.
Let's assume that we have to set background image of UIButton. Like this:
[button setBackgroundImage:image forState:UIControlStateNormal];
Oh my god. Aspect ratio has broken.
It's time to use UIButton+BackgroundContentMode to keep background image aspect ratio.
Use CocoaPods.
pod 'UIButton+BackgroundContentMode', '~> 0.1'
Import UIButton+BackgroundContentMode
, then set backgroundContentMode
of UIButton.
For example:
button.backgroundContentMode = UIViewContentModeScaleAspectFit;
button.backgroundContentMode = UIViewContentModeScaleAspectFill;
Finish! Set background image and enjoy coding.
UIButton+BackgroundContentMode is under MIT license. See the LICENSE file for more info.