SWIFT Unable to get total amount for live view on Click button
SWIFT Unable to get the total amount for live preview when clicking the button.
when i Enter data into one custom-dynamic view (TextField) and in another Cust-Dynamic (TextField) mode the data entered.
I want the sum of these two Txt fields in a TextField Outside.
Can anyone help me with this code,
if you could see below. In general Sqft there is a total text field of sums, and the number of Cust-Dynamic View is called the sum of all the results of text fields that need to be updated in a common quadratic TextField. eg: 99 + 99 = 198.00 Thanks in Advance.
func viewcall()
{
// for _ in 0..<count {
myView = customSubView(frame: CGRect(x: 100, y: 220+y_value, width: 400, height: 245))
myView.backgroundColor = UIColor(white: 1, alpha: 0.5)
myView.layer.cornerRadius = 15
myView.Board_height.addTarget(self, action: #selector(didChangeText(textField:)), for: .editingChanged)
myView.actionButton.addTarget(self, action: (#selector(cancelbutton(_:))), for: UIControlEvents.touchUpInside)
myView.NoofBoardtext.addTarget(self, action:#selector(didChangeTexts(textField:)), for: .editingChanged)
myView.numberofdays.addTarget(self, action:#selector(dayscalculation(textField:)), for: .editingChanged)
self.scrlview.addSubview(myView)
}
func didChangeText(textField: UITextField)
{
myView.Board_total.text = String(Int(myView.Board_size.text!)! * Int(myView.Board_height.text!)!)
}
//only Calculation for total SQFT
func didChangeTexts(textField: UITextField)
{
myView.totalSQFT.text = String(Int(myView.NoofBoardtext.text!)! * Int(myView.Board_total.text!)!)
}
//only Calculation for total SQFT
func dayscalculation(textField: UITextField)
{
myView.totalDays.text = myView.numberofdays.text!
myView.Totalsqfttext.text = String(Int(myView.totalSQFT.text!)! * Int(myView.numberofdays.text!)!)
overallSQFTtext.text = myView.Totalsqfttext.text
}
+3
source to share
No one has answered this question yet
Check out similar questions: