Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let myImage: UIImage = UIImage(named: "enthusiastic-people2.jpg")!
let myScaleDownView: UIImageView = UIImageView(frame: CGRect(x: 100, y:30, width: 80, height: 80))
myScaleDownView.image = myImage
myScaleDownView.transform = CGAffineTransformMakeScale(0.5, 0.5)
self.view.addSubview(myScaleDownView)
let myScaleUpView: UIImageView = UIImageView(frame: CGRect(x: 100, y:120, width: 80, height: 80))
myScaleUpView.image = myImage
myScaleUpView.transform = CGAffineTransformMakeScale(1.5, 1.5)
self.view.addSubview(myScaleUpView)
let myRotateView: UIImageView = UIImageView(frame: CGRect(x: 100, y: 250, width: 80, height: 80))
myRotateView.image = myImage
let angle:CGFloat = CGFloat((30.0 * M_PI) / 180.0)
myRotateView.transform = CGAffineTransformMakeRotation(angle)
self.view.addSubview(myRotateView)
let myReverseView: UIImageView = UIImageView(frame: CGRect(x:100, y: 360, width: 80, height: 80))
myReverseView.image = myImage
myReverseView.transform = CGAffineTransformScale(myReverseView.transform, -1.0, 1.0)
self.view.addSubview(myReverseView)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment