TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Sep 2015 |
Maintained by Joshua Greene.
BestFitImageView
automatically selects the best contentMode
by comparing its image size to its frame size.
If the image width and height are less than the frame width and height, the contentMode
will be set to UIViewContentModeCenter
.
Otherwise, the contentMode
will be set to UIViewContentModeScaleAspectFit
.
You can manually include BestFitImageView
by doing the following:
1) Clone this repo locally onto your computer, or press Download ZIP
to simply download the latest master commit.
2) Drag BestFitImageView.h
and BestFitImageView.m
into your project, making sure Copy items into destination group's folder (if needed)
is checked.
Use BestFitImageView
where you would normally you use UIImageView
. The contentMode
will be automatically set for you based on the size of the image.
Other than this, BestFitImageView
behaves the same way as UIImageView
does.
BestFitImageView
only considers the size of its image
to determine the contentMode
.
For the best results, related images (e.g. highlightedImage
) should be the same size.
BestFitImageView
is available under the MIT license (see the LICENSE
file for more details).