UIImageViewModeScaleAspect
Create animation of a UIImageView between twice contentMode ( UIViewContentModeScaleAspectFill / UIViewContentModeScaleAspectFit )
Install / Use
/learn @VivienCormier/UIImageViewModeScaleAspectREADME
UIImageViewModeScaleAspect (2.0)
<p>Create animation of a UIImageView between two contentMode ( UIViewContentModeScaleAspectFill / UIViewContentModeScaleAspectFit )</p> <a href="http://ios-developer.fr/" target="_blank">My WebSite</a> - <a href="https://twitter.com/VivienCormier" target="_blank">My Twitter</a>Compatible Swift 3.0
Screenshot & Demo Video
<p>To see a demo video, click <a href="http://www.youtube.com/watch?v=vZYbQ0Yt8eQ" target="_blank">here</a></p> <a href="http://www.youtube.com/watch?v=vZYbQ0Yt8eQ" target="_blank"> <img alt="ScreenShot Demo Video" src="https://github.com/VivienCormier/UIImageViewModeScaleAspect/blob/master/Example/UIImageViewModeScaleAspect/UIImageViewModeScaleAspect/example_1.png?raw=true" width="500" height="391" /> <img alt="ScreenShot Demo Video" src="https://github.com/VivienCormier/UIImageViewModeScaleAspect/blob/master/Example/UIImageViewModeScaleAspect/UIImageViewModeScaleAspect/example_2.png?raw=true" width="500" height="391" /> </a>How To Get Started
<p>Use Pod (or download and add "UIImageViewModeScaleAspect.swift" in your xcodeprojet.) : </p>pod 'UIImageViewModeScaleAspect'
<p>Init the UIImageViewModeScaleAspect. Important ! Do not forget to init the contentMode :</p>
``` swift
let myImage = UIImageViewModeScaleAspect(frame: CGRect(x: 0, y: 100, width: 200, height: 100))
myImage.contentMode = .scaleAspectFill // Add the first contentMode
myImage.image = UIImage(named: "Octocat")
view.addSubview(myImage)
```
Automatic animation
<p>For convert UIViewContentModeScaleAspectFill to UIViewContentModeScaleAspectFit :</p> ``` swift myImage.animate( .fit, frame: CGRect(x: 0, y: 0, width: 200, height: 200), duration: 0.4) ``` <p>For convert UIViewContentModeScaleAspectFit to UIViewContentModeScaleAspectFill :</p> ``` swift myImage.animate( .fill, frame: CGRect(x: 0, y: 0, width: 200, height: 200), duration: 0.4) ```Manual animation
<p>For convert UIViewContentModeScaleAspectFill to UIViewContentModeScaleAspectFit :</p> ``` swift myImage.initialeState(.fit, newFrame: CGRect(x: 0, y: 100, width: 200, height: 100))UIView.animate(withDuration: 0,4, delay: 0, options: .allowAnimatedContent, animations: { // // Others Animation // myImage.transitionState(.fit) }, completion: { (finished) in myImage.endState(.fit) })
<p>For convert UIViewContentModeScaleAspectFit to UIViewContentModeScaleAspectFill :</p>
``` swift
myImage.initialeState(.fill, newFrame: CGRect(x: 0, y: 100, width: 200, height: 100))
UIView.animate(withDuration: 0,4, delay: 0, options: .allowAnimatedContent, animations: {
//
// Others Animation
//
myImage.transitionState(.fill)
}, completion: { (finished) in
myImage.endState(.fill)
})
Related Skills
next
A beautifully designed, floating Pomodoro timer that respects your workspace.
product-manager-skills
50PM skill for Claude Code, Codex, Cursor, and Windsurf: diagnose SaaS metrics, critique PRDs, plan roadmaps, run discovery, and coach PM career transitions.
pm
PM Agent Rule This rule is triggered when the user types `@pm` and activates the Product Manager agent persona.
devplan-mcp-server
3MCP server for generating development plans, project roadmaps, and task breakdowns for Claude Code. Turn project ideas into paint-by-numbers implementation plans.
