Any idea how to get inputAccessoryView to snap to the tab bar and not to the bottom of the screen?
I created a UIViewController and overrided the following methods:
-(BOOL)canBecomeFirstResponder {
return YES;
}
-(UIView *)inputAccessoryView {
CGRect frame = CGRectMake(0, 0, self.view.frame.size.width, 44);
self.keyboardInputAccessoryView =[[BRKeyboardInputBarView alloc] initWithFrame:frame leftButtonTitle:@"Left" andRightButtonTitle:@"Send"];
[self.keyboardInputAccessoryView setDelegate:self];
[self.keyboardInputAccessoryView setTranslatesAutoresizingMaskIntoConstraints:NO];
[self.keyboardInputAccessoryView removeFromSuperview];
return self.keyboardInputAccessoryView;
}
View controller with inputAccessoryView covering tab bar
In appearance, the view controller adds a view to the window, rather than a view of the current view of the controllers, which explains its positioning. However, if I delete the line:
[self.keyboardInputAccessoryView removeFromSuperview]
I get a crash when clicking in the text box of my accessory:
The view hierarchy is not prepared for the constraint:<NSLayoutConstraint:0x7fa0c2ca5f80 BRKeyboardInputBarView:0x7fa0c2d6fad0.bottom == UIInputSetContainerView:0x7fa0c295a2c0.bottom>
So, I think I'm asking, what is the right way to add the look of keyboard accessories so that it blends in well with the automatic layout and avoids crash, but also snaps to the view, not the window?