How to get inputAccessoryView to anchor above the UITabBar?
Asked Answered
R

1

12

I'm trying to figure out the best way to have a custom inputAccessoryView rest on top of a tab bar. Currently, I have an inputAccessoryView that rests at the very bottom of the screen, but it covers the tab bar. Any one know the best practice for shifting that inputAccessoryView up?

Currently I have a view defined in a storyboard with a tab bar. Its corresponding view controller takes the view and calls becomeFirstResponder. I've overwritten both: - (UIView *)inputAccessoryView and -(BOOL)canBecomeFirstResponder within the view's .m

Recessive answered 7/12, 2015 at 15:53 Comment(2)
Hi, did you manage to fix this?Prairie
From what I found @Prairie , Apple seems to discourage this approach. I ended up removing the tab bar by pushing the view over the tab bar controller which allowed me to avoid having to do what I described above. The only solution I could find here that seemed to work was using a UIToolbar instead, placing that above the tab bar, and using that as the input view. Sorry I can't be of more help!Recessive
C
0

Found a workaround by shifting toolbar frame by bottomSpacing = tabbar height:

- (void) layoutSubviews {
    [super layoutSubviews];
    CGRect origFrame = self.frame;
    origFrame.origin.y = _keyboardIsVisible ? 0 : -self.bottomSpacing;
    self.frame = origFrame;
}

Strangely it works well in JSQMessagesInputToolbar, but it's lost after animations if I do this in UIView that wraps toolbar, or maybe I'm missing something..

Cartel answered 1/6, 2018 at 11:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.