A UIImageView alternative that allows for animations between contentModes.
The API for PBImageView is exactly the same as a UIImageView. To animate the contentMode just wrap it in a UIView animation block.
let imageView = PBImageView(image: UIImage(named: "pineapple"))
imageView.contentMode = .scaleAspectFill
UIView.animate(withDuration: 1) {
imageView.contentMode = .scaleAspectFit
}
PBImageView subclasses UIView, not UIImageView. To use it in a storyboard place a UIView and set the Class
and Module
to PBImageView
To run the example project, clone the repo, and run pod install
from the Example directory first.
- iOS 8
- Swift 3.0
PBImageView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "PBImageView"
PBImageView is available under the MIT license. See the LICENSE file for more info.