samedi 23 juillet 2016

Trouble appending values to stack in swift

I've been trying to get this code to work but of no use! So the interface has a few buttons with numerical numbers in them (like a calculator). The task is to get the numerical values (in string) by using currentTitle method, converting into double and appendig to a stack (operandStack). I was able to get one value onto stack but after that, the button the does it greys out and I can't do anything more with it.

@IBAction func addOntoStack() {

    operandStack.append(dispValueInDouble)
    print("operandStack = (operandStack)")

}

var dispValueInDouble:Double{

    doubleLabel = NSNumberFormatter().numberFromString(label.text!)!.doubleValue
    print("label: (doubleLabel)")

    return doubleLabel

}

Aucun commentaire:

Enregistrer un commentaire