I have a class created in cocoa to draw some straight lines on the screen, I run the application and draw everything in the coordinates I give it. However I want to be able to assign the values from a textfield
that is in the viewcotroller
, but I get an error.
First in the class I create the object like this:
var texto:ViewController?
then I initiate the object and when I want to read the property text
I get an error, that's how I read it:
texto = ViewController()
leeTexto = texto?.valores.text
Now when I want to call the show I do it like this:
@IBAction func angulo(sender: UIButton) {
let recta = CGRect(x: 0, y: 0, width: 512, height: 512)
objetoDibujo = DrawExamples()
objetoDibujo?.drawRect(recta)
}
and this is the structure of the function:
override func drawRect(rect: CGRect) {
}