title: Swift - Add dot in Number Pad Keyboard
body: <p>How to add dot in Number Pad Keyboard?
  I want when I use notification UIKeyboardDidShowNotification a UIButton to appear over down left side of the Number Pad keyboard.</p>
  
  <p>This will be the frame of the button:
  <code>let dotButton = UIButton(frame: CGRectMake(0, 162, view.frame.width/3, 54))</code> ,
  but it has to be added as subview of the number pad keyboard to prevent hiding from it, how will be done ?</p>
  
  <p>Edit:
  I made it to appear like this</p>
  
  <pre><code>    dotButton.addTarget(self, action: "addDot:", forControlEvents: .TouchUpInside)
      dotButton.setTitle(".", forState: .Normal)
      dotButton.titleLabel?.font = UIFont(name: "Helvetica Neue", size: 25)
      dotButton.setTitleColor(UIColor.blackColor(), forState: .Normal)
      dispatch_async(dispatch_get_main_queue(), {
          let keyboardView:UIView = UIApplication.sharedApplication().windows.last?.subviews.first as! UIView
          self.dotButton.frame = CGRectMake(0, keyboardView.frame.size.height-54, self.view.frame.width/3, 54)
          keyboardView.addSubview(self.dotButton)
          keyboardView.bringSubviewToFront(self.dotButton)
      })
  </code></pre>
  
  <p>but now I don't know how when I click to the button to add . in the textField with method addDot I don't know how to tell to the textField to add a . need help again...</p>
  
  <p>Edit2:
  I made a class variable which is <code>textFieldInEdit:UITextField!</code>
  and in <code>func textFieldShouldBeginEditing(textField: UITextField) -&gt; Bool</code>
  I do this <code>textFieldInEdit = textField</code> and now my function <code>addDot</code> is:</p>
  
  <p><code>textFieldWhichEdit.text = "\(textFieldWhichEdit.text)."</code> ,</p>
  
  <p>but I've got another problem now.. I have fields with different keyboard types how to detect which keyboard appears and show the dot on the Number Pad only ?</p>
  
  <p>Edit3:</p>
  
  <pre><code>func textFieldDidBeginEditing(textField: UITextField) {
      if(textField.keyboardType.rawValue==4){
          textFieldWhichEdit = textField
          dotButton.hidden = false
      }else{
          dotButton.hidden = true
      }
  }
  </code></pre>
  
  <p>Done I've made a dot button on Number Pad keyboard :)
  If someone know better method can write it and I will accept the answer :)</p>