0

I have a UIViewController with a UITextField on which I call becomeFirstResponder() immediately in viewDidLoad(). Prior to calling that, I instantiate a UIButton and override:

override var inputAccessoryView: UIButton {
    return self.nextButton
}

override func canBecomeFirstResponder() -> Bool {
    return true
}

I cannot figure out how to resize the input accessory view. I want to make it taller but it is always 44 points tall. It is just a big UIButton - nothing special. Any suggestions?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
AttilaTheFun
  • 701
  • 2
  • 11
  • 19
  • From what I understand, it is meant to hold a UIToolbar there (which has a height of 44 also). And have standard buttons like, done/prev/next/cancel, etc. Just my two cents. – ReverseEffect Nov 18 '15 at 01:34
  • Hmm - so is there no way to resize it? I have seen implementations for resizing a UITextField in an inputAccessoryView like iMessage, though I haven't seen a good way to do it for other types of views. – AttilaTheFun Nov 18 '15 at 01:36
  • I found this if it helps: http://stackoverflow.com/questions/24971743/uitextfield-height-not-changing-when-set-as-inputaccessoryview-for-another-uitex Basically what I read there was that you need to change the frame itself. Have you tried using a -y? – ReverseEffect Nov 18 '15 at 01:40
  • Also if you take a look here, https://developer.apple.com/library/prerelease/tvos/documentation/UIKit/Reference/UITextField_Class/index.html#//apple_ref/doc/uid/TP40006888-CH3-SW52 , you see that as the example of the inputAccessoryView, Apple suggests using a UIToolbar. So I'm assuming there that it was hinted at being made for UIToolbars. – ReverseEffect Nov 18 '15 at 01:42
  • Yeah I can tell they made it for UIToolbars, though they work around it in iMessage. I tried setting the frame and reloading input views to no avail. – AttilaTheFun Nov 18 '15 at 01:46
  • I was able to pull it off with a UITextView with a frame of x = 0, y = -44, width = (main frame width), and height = 88. Essentially, I doubled the height of the UITextView. What frame are you using? – ReverseEffect Nov 18 '15 at 02:06
  • Can you post a working snippet with that frame so I can try it out? Thanks! – AttilaTheFun Nov 19 '15 at 02:22

0 Answers0