I am using a function to build my custom cell. the function used to create the cell is "makeMyList". The stepper I have successfully increments and decrements the itemQuantity textField. The trouble I am having comes with updating the "itemPrice" label. I want itemPrice.text to be quantity * price and update dynamically as the quantity either goes up or down dynamically.
Could someone possibly help me with how to get this to happen?
Thank you in advance!
class MyListTableViewCell: UITableViewCell
{
@IBOutlet weak var itemPrice: UILabel!
@IBOutlet weak var itemName: UILabel!
@IBOutlet weak var itemQuantity: UITextField!
@IBOutlet weak var stepper: UIStepper!
@IBAction func itemQuantityStepper(sender: UIStepper)
{
self.itemQuantity.text = Int(sender.value).description
}
override func awakeFromNib() {
super.awakeFromNib()
}
func makeMyList(myItem: MyList)
{
self.itemName.text = myItem.MyItemName
self.itemPrice.text = String(stepper.value * Double(myItem.MyItemPrice))
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
}
For anyone who has the same issue. Here is the answer to my own question.
Hope it helps!