Friday, 15 February 2013

xcode - String does not have a member named 'text' error in Swift -


I'm getting my let c: int? = To change the conversion.text.aut () I do not keep a member of 'text' error in the name of '[string]'. Does anybody know how the variable can be converted into integer?

I can not seem to multiply one to c .

  @Iboutlet var pickerView1: UIPickerView! @IBootletWare TextField 1: UITfixField! @IBOOTlet Enter weak variants units: UITextField! @ IBOutlet var Reply conversion: UITextField! Var brand = ["feet from meters", "cm to inch", "mm to inch"] var conversion = ["3", "4", "5"]  

pickerView Function

  func pickerView (pickerView: UIPickerView, didSelectRow line: Int, InComponent component: int) {if pickerView.tag == 0 {let: int? EnterUnits.text.toInt () b: int? = AnswerConversion.text.toInt () Let's c: Int? = Conversion.text.aut () Answer = (a!) * (C!) TextField1.text = brand [row] answerConversion.text = conversion [row] answerConversion.text = "\ (answer)"}  

I noticed that you do not need .text required just try to use

  f: int? = Conversion to .nt ()  

Oh and since conversion is an array, you have to use the string you want to use. Try to do this with something like conversion [index] (the index you want to use)

I found another way to do the following:

  f: int = int (conversion [index] .bridgeToObjectiveC (.) IntValue)  

Hope that helps :)


No comments:

Post a Comment