title: UITextField should change characters in range looping on false return
body: <p>I have a textfield that I auto format for phone numbers.  It inserts "(,),-" appropriately and manually implements a max length.  This is done through:</p>
  
  <pre><code>textField:shouldChangeCharactersInRange:replacementString:
  </code></pre>
  
  <p>The issue is when the the <code>textField</code> hits the max character, it limits it and buzzes the device (as expected), but it does this on a loop forever.  I put a <code>println</code> in the delegate method and its getting called multiple times per second.  I couldn't find anything related to this while searching the web.  Can anyone point me in the right direction towards some help?</p>
  
  <p>Here is the delegate method:</p>
  
  <pre><code>func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -&gt; Bool {
      let backspacing = (countElements(string) == 0) ? true : false
      let newCharNum = (backspacing) ? -1 : 1
  
      // validate phone number is &gt;= 10 characters
      if countElements(textfield.phoneNumber) + newCharNum &gt; 10 {
          println("TWO much")
          AudioServicesPlaySystemSound(1352)
          return false
      }
  
      // validate character is number
      if !backspacing &amp;&amp; "0123456789".rangeOfString(string) == nil {
          println("too much")
          AudioServicesPlaySystemSound(1352)
          return false
      }
  
      // color phone number header accordingly
      if countElements(textfield.phoneNumber) + newCharNum == 10 {
          textfield.valid = true
      }else{
          textfield.valid = false
      }
  
      // add/delete char accordingly
      if backspacing &amp;&amp; countElements(textfield.phoneNumber) &gt; 0 {
          textfield.phoneNumber = dropLast(textfield.phoneNumber)
      } else {
          textfield.phoneNumber += string
      }
  
      // format new number
      var tempStr:String = ""
      var count = 0
      for character in textfield.phoneNumber {
          if (count == 0) {
              tempStr += "("
          } else if (count == 3) {
              tempStr += ")"
          } else if (count == 6) {
              tempStr += "-"
          }
          count++
          tempStr.append(character)
      }
  
      textfield.text = tempStr
      return false
  }
  </code></pre>