title: How to add a 'Done' button to numpad keyboard in iOS
body: <p>So, the numpad keyboard doesn't come with a 'Done' or 'Next' button by default so I'd like to add one. In iOS 6 and below there were some tricks to add a button to the keyboard but they don't seem to be working in iOS 7.</p>
  
  <p>First I subscribe to the keyboard showing notification</p>
  
  <pre><code>[[NSNotificationCenter defaultCenter] addObserver:self
                                           selector:@selector(keyboardWillShow:)
                                               name:UIKeyboardWillShowNotification
                                             object:nil];
  </code></pre>
  
  <p>Then I try to add a button when the keyboard shows up:</p>
  
  <pre><code>- (void)keyboardWillShow:(NSNotification *)note 
  {
      // create custom button
      UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeSystem];
      doneButton.frame = CGRectMake(0, 50, 106, 53);
      doneButton.adjustsImageWhenHighlighted = NO;
      [doneButton setTitle:@"Done" forState:UIControlStateNormal];
      [doneButton addTarget:self action:@selector(dismissKeyboard) forControlEvents:UIControlEventTouchUpInside];
  
      // locate keyboard view
      UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];
      UIView* keyboard;
      for(int i=0; i&lt;[tempWindow.subviews count]; i++) 
      {
          keyboard = [tempWindow.subviews objectAtIndex:i];
          // keyboard view found; add the custom button to it
          if([[keyboard description] hasPrefix:@"UIKeyboard"] == YES)
          [keyboard addSubview:doneButton];
      }
  }
  </code></pre>
  
  <p>But the for loop doesn't run because it doesn't find any subviews. Any suggestions? I couldn't find any solutions for iOS7 so is there a different way I'm supposed to be doing this?</p>
  
  <p>Edit: Thanks for all the suggestions for toolbars guys but I'd rather not go down that route as I'm quite space poor (and it is kind of ugly).</p>