Help Im stuck with hiding keyboard


#1

Hi all this is the code for my page , but I have a problem I cannot hide the keyboard by tapping the return key, Ive followed Pauls tutorial to the letter and it will not work, is it because I am using a UISegment control, any help would be very appreciated — I’ve been on this for weeks

Jer

import Foundation
import UIKit
// These are my Variables to add values to calculatore
var blocksperSqmtr = 10.0
var noWallTies = 0.0
var insulation = 0.0
var bricksPerSqmtr = 120

// My Images and textFields
class BlockWallController: UIViewController {
@IBOutlet weak var blockImage: UIImageView!
@IBOutlet weak var wallHeight: UITextField!
@IBOutlet weak var wallLength: UITextField!
@IBOutlet weak var numberBlocks: UITextField!
@IBOutlet weak var wallTies: UITextField!
@IBOutlet weak var insulationBats: UITextField!
@IBOutlet weak var bricksPer: UITextField!
@IBOutlet weak var enter: UIImageView!

//Created the Segment Control with two functions 1 to load the cavity wall
// the other to load a single wall
@IBAction func wallTyoe(_ sender: UISegmentedControl) {
    switch sender.selectedSegmentIndex {
    case 0:
        changeControl()
       default:
        changeControl2()
      blockImage.isHidden = false
        enter.isHidden = true
    }
 
    wallHeight.text = String(format: "%.2f",Double(wallHeight.text!)!)// String(Double(wallHeight.text!)!)
  wallLength.text =  String(format: "%.2f",Double(wallLength.text!)!)//String(Double(wallLength.text!)!)
    blockImage.isHidden = false
    enter.isHidden = true
    print("hello")
}

override func viewDidLoad() {
super.viewDidLoad()

blockImage.isHidden = true
enter.isHidden = false

}
override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
    
}
//my functions to do all the calculation
func changeControl () {
    numberBlocks.text = String(format: "%.2f",Double(wallLength.text!)! * Double(wallHeight.text!)! * blocksperSqmtr)// String(Double(wallLength.text!)! * Double(wallHeight.text!)! * blocksperSqmtr)
   wallTies.text = String(format: "%.2f",Double(wallLength.text!)! * Double(wallHeight.text!)! * noWallTies)// String(Double(wallLength.text!)! * Double(wallHeight.text!)! * noWallTies)
    insulationBats.text = String(format: "%.2f",Double(numberBlocks.text!)! * insulation)// String(Double(numberBlocks.text!)! * insulation)
    }
func changeControl2 () {
    numberBlocks.text =  String(format: "%.2f",Double(wallHeight.text!)! * Double(wallLength.text!)! * blocksperSqmtr * 2)// String(Double(wallHeight.text!)! * Double(wallLength.text!)! * blocksperSqmtr * 2)
    wallTies.text = String(format: "%.2f",blocksperSqmtr * 2.4 * 2)
    insulationBats.text = String(format: "%.2f",blocksperSqmtr * 2.2 * 2)
    bricksPer.text = String(format: "%.2f",Double(wallHeight.text!)! * Double(wallHeight.text!)! * 120)
    
}
}