This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
import AVFoundation | |
class ClassImageEditingView:UIView{ | |
var context: CGContext? | |
var contextBounds = CGRect.zero | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ViewController: UIViewController, UIGestureRecognizerDelegate { | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(printHello)) | |
tapGestureRecognizer.delegate = self | |
view.addGestureRecognizer(tapGestureRecognizer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func drawImageScaled(_ image: UIImage?) { | |
print("we are scalling the drawing") | |
// just draws the image scaled down and centered | |
let selfRatio: CGFloat = frame.size.width / frame.size.height //change the size later | |
let imgRatio: CGFloat = (image?.size.width ?? 0.0) / (image?.size.height ?? 0.0) | |
var rect : CGRect | |
rect = CGRect(x: 0, y: 0, width: 0, height: 0) |