I am attempting to clear a drawing canvas for my simple drawing app. I have created a button to delete the image by seeing the UIImageView.image
to nil. However, nothing happens when the button is pressed.
The ViewController code:
import UIKit
var smoothLineView : SmoothLineView = SmoothLineView()
class ViewController: UIViewController {
@IBOutlet weak var mainDrawingCanvas: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
smoothLineView = SmoothLineView(frame: mainDrawingCanvas.bounds)
self.view.addSubview(smoothLineView)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func deleteCurrentCanvas(sender: AnyObject) {
mainDrawingCanvas.image = nil
}
}
The full project can also be found: https://github.com/BananaSplitio/OpenSketch